我在 TFS2013 使用 Team Build 时遇到问题,该 Team Build 进行构建然后发布网站。
当我使用 VS2013 和(右键单击)网站项目的发布网站选项从我的开发机器上发布网站时,一切正常。我在 TFS2013 构建服务器上收到以下错误:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(421,5):错误:
**Can't find the valid AspnetCompilerPath** [C:\Builds\3\Web\Development to WebDev\Sources\Web\Website\Development\ASP.NET\App\website.publishproj]
Done Building Project "C:\Builds\3\Web\Development to WebDev\Sources\Web\Website\Development\ASP.NET\App\website.publishproj" (default targets) -- FAILED.
**
我在 Team Build 设置中使用以下 MSBuild 参数。
/p:DeployOnBuild=true;VisualStudioVersion=12.0;DeployTarget=WebFileSystemPublish;PublishProfile=开发
开发 Web 转换在构建服务器上运行良好,以响应“PublishProfile=Development”参数。Web.Config 文件已针对我们的开发环境进行了适当的转换。如 MSBuild Argument 中所述,我使用 FileSystem 发布选项并希望保持这种状态。
我已修改构建服务器“C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets”以在目标“ConfigureForAspNetPreCompileMerge”中记录一些属性,如下所示':
<Message Text="[TargetFrameworkVersion]: $(TargetFrameworkVersion)" />
<Message Text="[AspnetCompilerPath]: $(AspnetCompilerPath)" />
<Message Text="[Framework40Dir]: $(Framework40Dir)" />
<Message Text="[MSBuildToolsRoot]: $(MSBuildToolsRoot)" />
<Message Text="[MSBuildRuntimeVersion]: $(MSBuildRuntimeVersion)" />
它将以下信息记录到 Team Build 的 website.log 文件中:ConfigureForAspNetPreCompileMerge:
[TargetFrameworkVersion]:v4.0 [AspnetCompilerPath]:[Framework40Dir]:C:\Program Files (x86)\MSBuild\v4.0.30319 [MSBuildToolsRoot]:C:\Program Files (x86)\MSBuild\ [MSBuildRuntimeVersion]:4.0。 30319
[Framework40Dir] 不同于我的本地机器在同一个 MSBuild 目标上记录相同的数据:
12> 任务参数:Text=[TargetFrameworkVersion]:v4.0 12>
[TargetFrameworkVersion]:v4.0 12> 任务参数:Text=[AspnetCompilerPath]:12> [AspnetCompilerPath]:12> 任务参数:Text=[Framework40Dir] : C:\Windows\Microsoft.NET\Framework\v4.0.30319 12> [Framework40Dir]: C:\Windows\Microsoft.NET\Framework\v4.0.30319 12> 任务参数:Text=[MSBuildToolsRoot]: C:\Program文件 (x86)\MSBuild\ 12> [MSBuildToolsRoot]: C:\Program Files (x86)\MSBuild\ 12> 任务参数:Text=[MSBuildFrameworkToolsRoot]: C:\Windows\Microsoft.NET\Framework\ 12>
[MSBuildFrameworkToolsRoot ]: C:\Windows\Microsoft.NET\Framework\ 12>
任务参数:Text=[MSBuildRuntimeVersion]: 4.0.30319 12>
[MSBuildRuntimeVersion]: 4.0.30319
[Framework40Dir] 的 TeamBuild 值为:'C:\Program Files (x86)\MSBuild\v4.0.30319' vs 我的本地 DEV 机器:C:\Windows\Microsoft.NET\Framework\v4.0.30319
这似乎很不寻常。
我还更改了 TeamBuild 文件:'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets' 以手动将 Framework40Dir 的属性设置为'C:\Windows\Microsoft.NET\Framework\v4.0.30319' 但这似乎会挂起整个 TeamBuild 进程,直到它到达那个点并永远运行 Team Build,直到我手动停止它。
这是在这里工作的相同解决方案:TFS Build Server cannot get publish profile to work: "Can't find the valid AspnetCompilerPath" 但它对我不起作用。该问题与我的问题相同。
构建服务器是最新的 TFS2013.3。我没有在该机器上安装 Visual Studio 2013,并且非常不想这样做。我读过 TFS Team Builds 不需要 VS。
非常感谢您对此问题的帮助.....谢谢。