Search code examples
asp.net-mvcaspnet-compiler

MVC3 .Net precompile issue in IIS 6


I have an MVC3 C# .Net web app and I am running aspnet_compiler on my app in order to precompile. I am running this command:

aspnet_compiler -v /dev/boe

Boe is the app in the dev structure under "Default Web Site". The above command is producing this error.

c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\dev_boe\25d5f53a\2ad742fc\App_Web_vujir5mm.0.cs(29): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'BOE' (are you missing an assembly reference?)
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\dev_boe\25d5f53a\2ad742fc\App_Web_vujir5mm.2.cs(29): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'BOE' (are you missing an assembly reference?)
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\dev_boe\25d5f53a\2ad742fc\App_Web_vujir5mm.3.cs(29): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'BOE' (are you missing an assembly reference?)

However, Models isn't in our solution. We have our Model objects in a Domain project that is referenced by our web app. It appears that the compiler is expecting a Models reference in our MVC app. Is this true? Or is something else causing this error?


Solution

  • I have had a similar error when trying to use the Razor engine on IIS 7.5 (even though .NET 4 was installed!)

    If you have a reference in your project as you suggest you may need to go into references, highlight it, go properties and under Copy Local, set this to true. Re-Publish and hopefully this will solve your problem as it did mine.