1

我在 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。

非常感谢您对此问题的帮助.....谢谢。

4

3 回答 3

2

请使用此路径 C:\Windows\Microsoft.NET\Framework\v4.0.30319 更改 $(Framework40Dir)。

于 2014-09-15T20:48:39.593 回答
2

我找到了秘方。我需要将我的 website.publishproj 文件项目部分中的 ToolsVersion 设置为“12.0”。

我还需要在 DefaultTemplate.xaml 'Run MSBuild for Project' 工作流活动中将 ToolsVersion 设置为“12.0”,如本文所述。

使用 TFS 2010 / 2012 构建模板构建 Visual Studio 2013 解决方案

TeamBuild 现在的工作方式类似于 VS2013 发布网站……但整个过程所需的时间几乎是我们之前使用的以前的 Web 部署项目的两倍。我将不得不调查是否有某种方法可以加快发布过程。

希望这可以帮助其他人解决这个问题。

于 2014-08-27T18:25:21.177 回答
2

我会将 vs2013 安装到构建服务器上,它消除了大部分这些问题,允许您针对单元测试运行代码覆盖率,并且只要您在开发机器上拥有有效的许可证,就不需要许可证。我知道这不是你想要的答案。

于 2014-08-18T20:47:52.387 回答