如何生成在Visual Studio中aspx.designer.cs? [英] How to generate aspx.designer.cs in visual studio?

查看:1699
本文介绍了如何生成在Visual Studio中aspx.designer.cs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前aspx.designer.cs工作不正常,没有任何人有关于在Solution Explorer再生aspx.designer.cs任何想法。


解决方案


  

在Visual Studio中:

  1)删除您aspx.designer.cs文件2)右键点击你的aspx文件,并选择转换为Web应用程序

这应该添加aspx.designer.cs背部和最新的。


  
  

如果你得到一个错误说:


  
  

设计师文件的生成失败:方法或操作未实现。


  
  

尝试关闭Visual Studio的,然后重新打开你的项目并再次执行步骤二号


和<一个href=\"http://swsharinginfo.blogspot.nl/2012/03/regenerate-designer-file-in-visual.html\">here:


  

丢失或损坏,设计师文件会导致的Visual Studio(VS)失败的构建。这是因为没有设计师VS文件无法找到控件的声明。也大部分时间
  控件不添加到designer.cs给构建错误。


  
  

要解决此问题,下面是我所知道的最简单的解决方案:


  
  

      
  1. 删除你的设计师文件,如果它被损坏,否则从第二步开始。

  2.   
  3. 转到您的ASPX标记(源)页面,找到下面code线。 &LT;%@页面语言=C#AutoEventWireup =假
      codeFILE =SamplePage.aspx.cs继承=SamplePageClass%GT;

  4.   
  5. 现在,C $ CFILE标签更改为$ codeBehind。

  6.   
  7. 保存文件。

  8.   
  9. 重建项目(这会为你的页面设计文件)

  10.   
  11. 恢复您的更改(第三步)。

  12.   

My current aspx.designer.cs is not working properly, does anybody have any idea about regenerating aspx.designer.cs in solution explorer.

解决方案

Found here:

Within the Visual Studio:

1) Remove your aspx.designer.cs file

2) Right click on your aspx file and select "Convert to Web Application"

This should add the aspx.designer.cs back and up to date.

If you get an error saying:

"Generation of designer file failed: The method or operation is not implemented."

Try close Visual Studio and then reopen your project and do step number two again

And here:

Missing or corrupted designer file causes Visual studio (VS) to fail the build. This is because without designer file VS is unable to find the declarations of controls. Also most of the time controls are not added to designer.cs giving build errors.

To fix this issue, Below is the simplest solution I know:

  1. Delete your designer file if it is corrupted else start from step2.
  2. Go to your aspx markup (source) page and find below line of code. <%@ Page Language="C#" AutoEventWireup="false" CodeFile="SamplePage.aspx.cs" Inherits=" SamplePageClass" %>
  3. Now change CodeFile tag to CodeBehind.
  4. Save the file.
  5. Rebuild your project (This will create designer file for your page)
  6. Revert your change (Step3).

这篇关于如何生成在Visual Studio中aspx.designer.cs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆