本文介绍了Visual Studio 2005 设计器未向 aspx.Designer.cs 添加控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是 Designer 的粉丝,我更喜欢直接编码到 ASPX 页面.但是,由于重新格式化(并导致重新格式化),当手动编码到 .aspx 文件时,designer.cs 文件没有正确更新.这意味着我的 代码隐藏 无法识别新控件并抛出编译器错误.

I'm not a fan of the Designer, I prefer to code straight to the ASPX page. However, since a reformat (and leading up to the reformat), the designer.cs files have not been updating correctly when manually coding to the .aspx file. This means my code behinds are not recognizing new controls and throwing compiler errors.

如何防止或者在手动编码aspx文件后强制重新编译designer.cs文件?我知道我可以手动将控件输入到设计器文件中,但在创建较大的 aspx 页面时,这既耗时又令人讨厌.

How can this be prevented or the designer.cs file to be forced to recompile after manually coding the aspx file? I know I can type the controls manually into the designer file, but this is time consuming and well, obnoxious when creating larger aspx pages.

编辑

WebDude 的答案过去有效,但切换到设计视图不再以任何程度的一致性解决问题.还有更多想法吗?

WebDude's answer used to work, but switching to design view no longer solves the problem with any degree of consistency. Any more ideas?

推荐答案

简单的解决方案,

删除designer.cs页面,右击aspx/ascx页面,选择Convert to Web Application.

Delete the designer.cs page, right click on the aspx/ascx page and choose Convert to Web Application.

你已经准备好了!!!

巴韦什

这篇关于Visual Studio 2005 设计器未向 aspx.Designer.cs 添加控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 23:35