ASP.NET MVC 1.0 AfterBuilding Views fails on TFS Build

后端 未结 9 1361
你的背包
你的背包 2020-12-12 17:42

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):


  ...         


        
相关标签:
9条回答
  • 2020-12-12 18:41

    You cannot pre-build an ASP.NET MVC application.

    0 讨论(0)
  • 2020-12-12 18:44

    I had some old folders in my source control that were not visible in the Solution.

    0 讨论(0)
  • 2020-12-12 18:49

    The problem stems from the fact that the AspNetCompiler MSBuild task used within the AfterBuild target of an ASP.NET MVC project expects to reference the dll's in the bin folder of the Web project.

    On a desktop build the bin folder is where you would expect it under your source tree.

    However TFS Teambuild compiles the output of your source to a different directory on the build server. When the AspNetCompiler task starts it cannot find the bin directory to reference the required DLL and you get the exception.

    Solution is to modify the AfterBuild target of the MVC Project to be as follows:

      <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>
    

    This change enables you to compile Views on both the desktop, and the TFS build server.

    0 讨论(0)
提交回复
热议问题