Ian Obermiller

Part time hacker, full time dad.

Type or namespace does not exist when compiling MVC View


I ran into the following common error when trying to run my ASP.NET MVC 4 website:

d:\temp\2pirqzul.5yz\temp\root\898a687c\8681620c\App_Web_jfuizczv.0.cs(27): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'DealBoxy' (are you missing an assembly reference?)

While normally a straightforward error, this one was confusing, because I was certain that I had referenced the DealBoxy project correctly.

It turns out that DealBoxy was compiling to an exe, and apparently ASP.NET won't load exes the same way it will dlls. Changing the Output type to Class Library in the Application tab of the project settings did the trick.