如何解决 The name ControlID does not exist in the current context 错误!

最近把新建的网站转化到 visual studio 2008的 Web Application 项目,很多文件都是重复的,我就偷懒直接复制到项目根目录下,重新编译之后 结果一大堆的错误提示类似: The name ControlID does not exist in the current context

明显这些控件在aspx上都有,并且在cs文件中都会智能提示,怎么会提示不存在呢? 经过与Web Application自身新建的文件对比,发现都少了结构类似 **.designer.cs的文件,尝试如下方法解决问题!

在项目资源管理器中找到这些提示控件报错的*.cs文件,右击改文件-----属性----Build Action的属性值由Compile 改成 Embedded Resource  再次 Rebuild ,Ok 全部通过! 

大家有什么更好办法,不妨分享一下! 

原文地址:https://www.cnblogs.com/finesite/p/1823923.html