.net - Visual Studio Online MsBuild 在 System.Object 上失败

标签 .net build msbuild azure-devops

构建服务器正在产生此错误:

The type 'System.Object' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Web.Config 包含该配置:

  <system.web>
    <compilation debug="true" targetFramework="4.5.2">
      <assemblies>
        <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5.2"/>
  </system.web>

我还将 MsBuild 参数更改为

 /p:TargetFrameworkVersion=v4.5.2

这没有帮助。还是同样的错误。 我还在构建服务器上看到多个警告:

C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (990): 
The reference assemblies for framework ".NETFramework,Version=v4.5.2" were not found. 
To resolve this, install the SDK or Targeting Pack for this framework version or 
retarget your application to a version of the framework for which you have the SDK 
or Targeting Pack installed. Note that assemblies will be resolved from the Global 
Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore
your assembly may not be correctly targeted for the framework you intend.

如何让构建服务器 (Visual Studio Online) 构建此 .Net 4.5.2 项目?

编辑

我也有很多这种类型的警告消息:

C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (990): 
The reference assemblies for framework ".NETFramework,Version=v4.5.2" were not found. 
To resolve this, install the SDK or Targeting Pack for this framework version or retarget 
your application to a version of the framework for which you have the SDK or Targeting 
Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC)
 and will be used in place of reference assemblies. Therefore your assembly may not be 
correctly targeted for the framework you intend.

最佳答案

Visual Studio Online (VSO) 不支持最新的 .Net Framework。我与 VSO 团队进行了实习生讨论,这是计划在不久的将来进行的。短期解决方案是使用以前的 .Net 框架进行编译,直到 VSO 发布此新功能。

关于.net - Visual Studio Online MsBuild 在 System.Object 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25375581/

相关文章:

.net - 使用 WEB API OData v4 调用元数据时出现 404 错误

.net - NUnit 和与 Jenkins 的持续集成 : which NUnit-files are needed?

.net - Mono 中的代码契约

build - 如何使用 gyp 生成 "make install" Action ?

ios - 在 "Performing Install Actions"上构建滞后一分钟

c# - 如何为 VS2012 C# 项目执行自定义构建步骤?

c# - 为什么我无法在安装 Roslyn SDK 后创建新的分析器/代码修复提供程序项目?

cmake 预构建命令从外部存储库复制文件

c# - 将另一个构建排队,然后等待构建完成

msbuild - 数据库 msbuild 发布无法从命令行运行