I guess I have been using the Web Site model ever since .NET 2.0 and never looked back. Now I'm using the Web Application mode on a few projects. How do you tell the compiler to compile .cs files in the project? I assume you can do this since the newer-MVC projects do it for the Controllers.
我想自从.NET 2.0以来我一直在使用网站模型,从未回头。现在我在几个项目上使用Web应用程序模式。你如何告诉编译器在项目中编译.cs文件?我假设您可以这样做,因为较新的MVC项目为控制器执行此操作。
I have a class, RestRouteHandler, that implements the IRouteHandler interface but because I think the .cs file is not being compiled I can't use it in my Global.asax.
我有一个类,RestRouteHandler,它实现了IRouteHandler接口,但因为我认为.cs文件没有被编译,我不能在我的Global.asax中使用它。
2 个解决方案
#1
Right-click the .cs file in the Solution Explorer and click Properties. Set the "Build Action" to compile.
在解决方案资源管理器中右键单击.cs文件,然后单击“属性”。设置“Build Action”进行编译。
#2
use the "Build" menu in Visual Studio
使用Visual Studio中的“生成”菜单
#1
Right-click the .cs file in the Solution Explorer and click Properties. Set the "Build Action" to compile.
在解决方案资源管理器中右键单击.cs文件,然后单击“属性”。设置“Build Action”进行编译。
#2
use the "Build" menu in Visual Studio
使用Visual Studio中的“生成”菜单