Q:

receiving "error ASPPARSE: Could not load type ..." error with msbuild on MVC webapp

We have CCNET and msbuild creating our regular builds.  I am trying to update our process so msbuild creates zipped deployment packages and msdeploy sends them out to the target IIS7 web servers.  I was having trouble doing the end to end solution, so for testing I'm trying to just call msbuild from the command line for now.  I execute this statement:
msbuild /target:Build;Package /P:Configuration=Staging;OutDir=D:\Builds\Viper.ProdSupport\MSDeployPkg\ /verbosity:diagnostic D:\builds\ViperPortal.ProdSupport\Code\Viper\Viper.UI.MVC\Viper.UI.MVC.csproj

and I get this error:
/temp/global.asax(1): error ASPPARSE: Could not load type 'Viper.UI.MVC.MvcApplication'. [D:\builds\ViperPortal.ProdSupport\Code\Viper\Viper.UI.MVC\Viper.UI.MVC.csproj]
Oh, and for our specs: .NET4, MVC3, IIS7/Win2k8 64bit for web server.  Build server is Win2k8 as well, but I'm testing the scripts locally on a win 7 32bit box with ccnet and a full dev config mgmt environment setup locally.  
Does anyone have any ideas why I'm getting this error?  I read some messages complaining about the aspnet compiler or changing where your bin deploys assemblies to, but none of those seemed to really apply here.  I am simply trying to call msbuild, which has been working all along til now.  We have a custom msbuild script for our solution.  I tried using both that and the mvc csproj file as the build configuration file.  Please help!  Thanks!

A:

this happens if you've set to precompile views, i.e. you changed:
<MvcBuildViews>false</MvcBuildViews>

to
<MvcBuildViews>true</MvcBuildViews>

This is because MSBuild throws the output to different places than Visual Studio might, so you should change the folder on which the precompiling runs on from:
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />

to:
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />

