【发布时间】:2014-10-12 02:11:11
【问题描述】:
构建服务器产生此错误:
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.
如何让 Build Server (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.
【问题讨论】:
-
您确定在此服务器上安装了 .NET 4.5 吗?
-
这可能会有所帮助...stackoverflow.com/questions/16675171/…
-
@Mick 是的,我很确定 (google.com/…),今晚我会检查你回家的链接
-
不起作用。我会尝试在 4.5.0 中编译
标签: .net build msbuild azure-devops