【问题标题】:Postsharp problems on teamcityteamcity 上的 Postsharp 问题
【发布时间】:2015-07-09 14:30:01
【问题描述】:

我们有一个跟踪 .net 框架 4.0 的项目,我们正在使用 postsharp。在我的本地机器上一切正常,但在我们的 teamcity 服务器上,我们收到以下错误

00:44][MSBuild output] "C:\TeamCity\buildAgent\work\a26b6bf43590f451\Main\myproj.csproj" (default target) (4:2) ->
[16:00:44][MSBuild output] (PostSharp30 target) -> 
[16:00:44][MSBuild output]   unknown : error PS0219: The targeting pack for target platform ".NETFramework,Version=v4.0" is either not installed or not properly registered. Please install the appropriate targeting pack. [C:\TeamCity\buildAgent\work\a26b6bf43590f451\Main\myproj.csproj]
[16:00:44][MSBuild output] 
[16:00:44][MSBuild output]     2 Warning(s)
[16:00:44][MSBuild output]     1 Error(s)
[16:00:44][MSBuild output] 
[16:00:44][MSBuild output] Time Elapsed 00:00:30.78

【问题讨论】:

  • 只是猜测:如果您刚刚在构建服务器上安装了 .NET Framework 4.0,则重新启动服务器并尝试触发手动构建,否则在服务器上安装 .NET Framework 4.0 SDK。

标签: .net msbuild continuous-integration teamcity postsharp


【解决方案1】:

您收到的错误表明将 .NET SDK 注册到 MSBuild 时存在一些问题。 PostSharp 使用 MSBuild 调用来确定已安装的框架并获取有关这些的信息。您可以通过查看 C:\ProgramData\PostSharp\InstalledFrameworks 目录和其中的最新 XML 文件来检查 PostSharp “看到”的内容。

要解决此问题,请在构建服务器上安装 Microsoft Build Tools 2013。然后,在 TeamCity 中配置构建步骤时,请确保您选择了 Microsoft Build Tools 2013 和 MSBuild 12.0。 .NET 4.5 (Visual Studio 2012) 的 MSBuild 也可以使用。

【讨论】:

  • 谢谢,但我无法让它工作。我安装了 Visual Studio 2013,但是当我打开解决方案并尝试在那里构建它时遇到了同样的错误。
  • 能否请您在我们的支持网站上与我们联系并发送InstalledFrameworks 目录的内容和构建日志?
【解决方案2】:

这并不是真正的 PostSharp 错误 — 您的构建代理可能只是没有安装正确版本的 Visual Studio。您可以安装 VS,也可以在构建代理上手动安装 appropriate targeting pack。 (该链接适用于 VS2013。如果您使用的是其他版本的 VS,请参阅该页面上的其他链接。)

了解此上下文中的“目标包”也称为“.NET SDK”可能会有所帮助。

【讨论】:

  • 我想补充一下,这个错误实际上是由PostSharp产生的,这也意味着主要的编译步骤已经成功完成。也许服务器上只有 .NET 4.5 SDK 并且 C# 编译器可以接受,即使目标是 .NET 4.0。
  • 谢谢,我已经安装了适用于 .net 4.0 和 4.0.3 的所有更新,但我仍然遇到同样的错误。
  • 这可能是 x86 与 x86_x64 兼容性的问题。服务器正在运行 x86_x64,但失败的步骤正在尝试执行 C:\ProgramData\PostSharp\4.1.15\bin.Release\postsharp.4.0-x86.exe。在同一文件夹中有一个 C:\ProgramData\PostSharp\4.1.15\bin.Release\postsharp.4.0-x64.exe。
  • 显然这与teamcity无关,我在构建服务器上安装了visual studioexpress,当我尝试在visual studio中构建时遇到同样的错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多