类文件上的 VS2010 Intellisense
我正在开发一个网络应用程序项目。
我的解决方案如下所示:
./MyProject/
./MyProject/dataobjects.cs <- no intellisense
./MyProject/sqlquerying.cs <- no intellisense
./MyProject/default.aspx <- intellisense works here
./MyProject/default.aspx.cs <- intellisense works here
./MyProject/mypage.aspx <- intellisense works here
./MyProject/mypage.aspx.cs <- intellisense works here
当我处理业务逻辑层和数据逻辑层等非代码隐藏文件时,Visual Studio 2010 不会为我提供任何智能感知选项。在 VS2008 中,我将这些文件放在 App_Code 文件夹中,并且智能感知工作正常。
我能做些什么? 是否需要将这些文件放入特定的文件夹才能获得智能感知?
I have a Web Application Project that I'm working on.
My solution looks like this :
./MyProject/
./MyProject/dataobjects.cs <- no intellisense
./MyProject/sqlquerying.cs <- no intellisense
./MyProject/default.aspx <- intellisense works here
./MyProject/default.aspx.cs <- intellisense works here
./MyProject/mypage.aspx <- intellisense works here
./MyProject/mypage.aspx.cs <- intellisense works here
Visual Studio 2010 doesn't give me any intellisense options when I work on non-code-behind files like Business Logic Layers and Data Logic Layers . In VS2008, I placed these files in the App_Code folder and intellisense worked fine.
What can I do?
Is there a specific folder I need to put these files in to get intellisense?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
找到了!
Visual Studio 将我的代码文件设置为“内容”,而不是构建选项的“编译”。
以下是 MSDN 论坛上相同问题的摘录< /a> 对于任何有兴趣的人:
Found it!
Visual Studio was setting my code files as 'Content' instead of 'Compile' for the build option.
Here's an excerpt from the same question on MSDN forums for anyone who's interested:
您可能拥有“网站”而不是“Web 应用程序”。
在网站中,非页面代码文件需要位于 App_Code 中或(理想情况下)位于引用的单独项目中。
You may have a "Website" rather than a "Web Application".
In a Website non-page code files need to be either in App_Code or (ideally) in a separate project that is referenced.
无论您将类文件放在何处,您都应该具有智能感知。这是从 VS 2008 网站转换而来的新 VS 2010 项目吗?
尝试右键单击该项目,然后选择“转换为 Web 应用程序”。
在 Web 应用程序中,您应该拥有 aspx 文件、设计器文件和代码隐藏文件。在将 VS 2008 网站转换为 VS 2010 Web 应用程序时,我也遇到过类似的奇怪情况。
You should have intellisense, regardless of where you put your class files. Is this a new VS 2010 project converted from a VS 2008 website?
Try right-clicking the project, and selecting 'Convert to Web Application'.
In a web application, You should have the aspx files, designer files, and code behind files. I have experienced similar oddities when converting a VS 2008 website to VS 2010 web application.