Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# asp.net中设计器文件存在的问题_C#_Asp.net_.net - Fatal编程技术网

C# asp.net中设计器文件存在的问题

C# asp.net中设计器文件存在的问题,c#,asp.net,.net,C#,Asp.net,.net,每当我在VS 2005中打开现有项目时,designer.cs文件不会显示在.aspx文件下,因此当我在.aspx中添加控件时,designer.cs不会更新 以下是结构的外观: +----AAAConfirm.aspx . . . ..AAAConfirm.aspx.cs . .----AAAConfirm.aspx.designer.cs 将项目复制到其他文件夹并 通过解决方案找到损坏的aspx.designer.cs文件 资源管理器仅从项目中删除designer.cs文件 右键单击

每当我在VS 2005中打开现有项目时,
designer.cs
文件不会显示在
.aspx
文件下,因此当我在
.aspx
中添加控件时,
designer.cs
不会更新

以下是结构的外观:

+----AAAConfirm.aspx
.  .
.  ..AAAConfirm.aspx.cs
.
.----AAAConfirm.aspx.designer.cs

将项目复制到其他文件夹并

  • 通过解决方案找到损坏的aspx.designer.cs文件
  • 资源管理器仅从项目中删除designer.cs文件
  • 右键单击主aspx文件并选择“转换为Web” 应用程序”
Ref:

您需要为项目“显示所有文件”,它很可能是意外地从项目文件中删除的。当您在Visual Studio中看到该文件时,右键单击该文件并选择“添加到项目”

检查项目文件并确保设计器文件的compile标记具有名为
DependentUpon的子元素

指定项目中包含的文件的XML部分应该如下所示

<Compile Include="AAAConfirm.aspx.designer.cs">
    <DependentUpon>AAAConfirm.aspx</DependentUpon>
</Compile>

AAAConfirm.aspx

还要检查标记页
AAAConfirm.aspx
标记中是否具有正确的codebehind和inherit引用。是否可能更改名称空间?尝试将
Inherits
属性值设置为不带名称空间的类名。

是否尝试显示所有文件?我已手动编辑csproj文件以解决此问题。不过,我没有一个2005年的项目来提供详细说明。正如我在上面的示例中提到的,文件是可见的。问题是层次结构。通常aspx.cs(codebehind)和designer.cs位于同一个(.aspx)下级别。但对我来说不同,如上所示。@Danny,我更新了我的答案。请尝试我的其他建议。根据您的第一个解决方案,文件已包含在项目中,正如我右键单击“显示选项->从项目中排除”时一样。根据第二个解决方案:指定文件包含在项目中的XML部分应如下所示:AAAConfirm.aspx aspxcodebeahind AAAConfirm.aspx'确实更改了名称空间。尝试将继承属性值设置为没有名称空间的类名。仍然存在相同的问题。Designer.cs未更新,因此我无法访问codebehind中的控件。我认为如果您复制
页面AAAConfirm.aspx的标记。如果您仍然需要帮助,我可能可以进一步提供帮助。