Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC 1.0 AfterBuilding Views fails on TFS Build

I've upgraded from ASP.NET MVC Beta to 1.0 and did the following changes to the MVC project (as descibed in the RC release notes):

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

While the build runs fine on our local dev boxes, it fails under TFS 2008 Build with "Could not load type 'xxx.MvcApplication'", see below build log:

... using "AspNetCompiler" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Task "AspNetCompiler"    Command:   C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v temp -p D:\Builds\xxx\Continuous\TeamBuild\Sources\UI\xxx.UI.Dashboard\\..\xxx.UI.Dashboard    The "AspNetCompiler" task is using "aspnet_compiler.exe" from "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe".   Utility to precompile an ASP.NET application   Copyright (C) Microsoft Corporation. All rights reserved.  /temp/global.asax(1): error ASPPARSE: Could not load type 'xxx.UI.Dashboard.MvcApplication'.   The command exited with code 1.  Done executing task "AspNetCompiler" -- FAILED. ... 

MVC 1.0 is installed on TFS and the solution compiles when built within a Visual Studio instance on the same TFS server.

How can I resolve this TFS Build issue?

like image 361
o_o Avatar asked Apr 16 '09 11:04

o_o


1 Answers

Actually, there's a better solution to this problem. I've tested it with VS/TFS 2010 but it should also work with VS/TFS 2008.

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

I'm going to work with the MVC team to update their project template to to use this approach along with a custom target (rather than overriding AfterBuild).

I've published a blog post on How to Turn on Compile-time View Checking for ASP.NET MVC projects in TFS Build 2010.

like image 50
Jim Lamb Avatar answered Sep 29 '22 13:09

Jim Lamb