【问题标题】:TFS Build Server "Can't find the valid AspnetCompilerPath" for TeamBuild publishing a Website用于 TeamBuild 发布网站的 TFS 构建服务器“找不到有效的 AspnetCompilerPath”
【发布时间】:2014-10-11 16:57:40
【问题描述】:

我在 TFS2013 使用 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=Development

开发 Web 转换在构建服务器上正常工作,以响应“PublishProfile=Development”参数。这 Web.Config 文件为我们的开发环境正确转换。 如 MSBuild 参数中所述,我使用 FileSystem 发布选项并希望保持这种状态。

我已经修改了构建服务器 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets' 在 Target '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:

[目标框架版本]:v4.0 [AspnetCompilerPath]: [Framework40Dir]:C:\Program Files (x86)\MSBuild\v4.0.30319 [MSBuildToolsRoot]:C:\Program 文件 (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 Files (x86)\MSBuild\ 12> [MSBuildToolsRoot]: C:\Program Files (x86)\MSBuild\ 12> 任务 参数:文本=[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。

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

【问题讨论】:

    标签: tfs msbuild web-site-project publish-profiles


    【解决方案1】:

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

    【讨论】:

    • 感谢您的回复。这是我的下一个选择,除非弹出其他内容。
    • 在 TFS2013 构建服务器上安装带有更新 3 的 VS2013 后,结果相同。 [Framework40Dir]:C:\Program Files (x86)\MSBuild\v4.0.30319 设置为“ConfigureForAspNetPreCompileMerge”的 TeamBuild 目标中的 MSBuild 目录位置。
    • 你登录到构建服务器并在vs上构建了吗?
    • 在 TFS2013 Build Server 上的 VS2013 中,成功构建并发布了解决方案....和我的开发机器一模一样。同样,Team Build 失败并出现以下错误:C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(423,5):错误:找不到有效的 AspnetCompilerPath
    • 您使用的是哪个模板?
    【解决方案2】:

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

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

    Building Visual Studio 2013 solutions with your TFS 2010 / 2012 Build Templates

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

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

    【讨论】:

      【解决方案3】:

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

      【讨论】:

      • 或将 /p:Framework40Dir="C:\Windows\Microsoft.NET\Framework\v4.0.30319" 添加到 msbuild 命令行。
      猜你喜欢
      • 2014-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-04
      • 1970-01-01
      • 2012-12-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多