o_o*_*o_o 62 asp.net asp.net-mvc tfsbuild
我已经从ASP.NET MVC Beta升级到1.0并对MVC项目进行了以下更改(如RC发行说明中所述):
<Project ...>
...
<MvcBuildViews>true</MvcBuildViews>
...
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
</Target>
...
</Project>
Run Code Online (Sandbox Code Playgroud)
虽然构建在我们的本地开发盒上运行良好,但它在TFS 2008 Build下"无法加载类型'xxx.MvcApplication'"失败,请参阅下面的构建日志:
...
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.
...
Run Code Online (Sandbox Code Playgroud)
MVC上安装了MVC 1.0,该解决方案在同一TFS服务器上的Visual Studio实例中构建时进行编译.
如何解决此TFS Build问题?
Jim*_*amb 180
实际上,这个问题有一个更好的解决方案.我已经使用VS/TFS 2010进行了测试,但它也适用于VS/TFS 2008.
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
Run Code Online (Sandbox Code Playgroud)
我将与MVC团队合作更新他们的项目模板,以便将此方法与自定义目标一起使用(而不是覆盖AfterBuild).
我发布了一篇关于如何在TFS Build 2010中启用ASP.NET MVC项目的编译时查看检查的博客文章.
cro*_*eym 17
问题源于这样一个事实,即ASP.NET MVC项目的AfterBuild目标中使用的AspNetCompiler MSBuild任务期望引用Web项目的bin文件夹中的dll.
在桌面构建中,bin文件夹是您在源树下所期望的位置.
但是,TFS Teambuild会将源的输出编译到构建服务器上的其他目录.当AspNetCompiler任务启动时,它无法找到bin目录来引用所需的DLL,并且您获得了异常.
解决方法是将MVC项目的AfterBuild目标修改为如下:
<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>
Run Code Online (Sandbox Code Playgroud)
此更改使您可以在桌面和TFS构建服务器上编译视图.
| 归档时间: |
|
| 查看次数: |
13114 次 |
| 最近记录: |