Archive for November 24th, 2010

Simply put: “it does not work out of the box”. Building the MVC website on the development desktop is ok. When checking the code and building using the TFS it crashes:

[Any CPU/Release] /temp/global.asax(1,0): error ASPPARSE: Could not
load type 'TestMVCApp.MvcApplication'.

The reason is simple but not easy to find out. It seems the AspNetCompiler expects the dll’s to be found in the Bin directory and TFS puts the output in a different folder. Thus the AfterCompile step fails. To fix this we need to change (using notepad) the csproj of the web project.

Original:

<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
  <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>

Fixed version:

<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
  <AspNetCompiler Condition="'$(IsDesktopBuild)' != 'false'"
     VirtualPath="temp"
     PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
  <AspNetCompiler Condition="'$(IsDesktopBuild)' == 'false'"
     VirtualPath="temp"
     PhysicalPath="$(PublishDir)\_PublishedWebsites\$(ProjectName)" />
</Target>

Hopefully MS will fix this in the future.

Comments No Comments »