views:

526

answers:

2

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.

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.

A: 

use the "Build" menu in Visual Studio

Jason
I do. Then I get this message: The type or namespace name 'RestRouteHandler' could not be found (are you missing a using directive or an assembly reference?)
tyndall
The other weird thing... Is when I add a .cs file to my project. It comes in completely blank. No code. weird.
tyndall
are you missing a reference or using statement in your code? If your templates are empty it may be worth it to try reinstalling VS.NET and all of the Service Packs.
Jason
+3  A: 

Right-click the .cs file in the Solution Explorer and click Properties. Set the "Build Action" to compile.

Jon Tackabury
That's the ticket. Ran into this other day and couldn't remember that's how I fixed it. Thanks. +1 and answer.
tyndall
No problem. I ran into this a few times as well after I converted some projects to Web Applications.
Jon Tackabury