ASP.NET MVC project and TFS Team build issue

I was trying to include my ASP.NET MVC project in a TFS team build today but the build failed so I've investigated this issue and thought it will be helpful to share it with the community.

To get the MVC project build successfully with the team build make sure of the following:

- Your build server has the WebApplication targets file located in <Program Files> \MSBuild\Microsoft\Visual Studio\v9.0\WebApplications , if not . copy this file from your development machine to the same path in the build server.

- You have installed ASP.NET MVC framework in the Build server, this is the most important step otherwise you application will not build successfully in the team build you may faces some errors like :

error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

or

Controllers\RuleController.cs(31,10): error CS0246: The type or namespace name 'AcceptVerbs' could not be found (are you missing a using directive or an assembly reference?)

 

** Update

This will work with Beta version of ASP.NET MVC since the installation register the MVC assembly in GAC.

For preview versions , you can reference the DLL from your build project

<AdditionalReferencePath Include="C:\Program Files\Microsoft ASP.NET\ASP.NET MVC CodePlex Preview 4\Assemblies" />

 

Thanks !

No Comments