问题描述
我的构建服务器出现一堆错误:
I'm getting a bunch of errors on my build server:
C:WINDOWSMicrosoft.NETFrameworkv4.0.30319Microsoft.Common.targets(847,9):警告 MSB3644:未找到框架.NETFramework,Version=v4.0"的参考程序集.要解决此问题,请为此框架版本安装 SDK 或 Targeting Pack,或者将您的应用程序重新定位到已安装 SDK 或 Targeting Pack 的框架版本.请注意,程序集将从全局程序集缓存 (GAC) 中解析,并将用于代替引用程序集.因此,您的程序集可能无法正确定位于您想要的框架.[D:adismercuryAdisFeedscacheAdis.Feeds.Cache.ConsoleManagerAdis.Feeds.Cache.ConsoleManager.csproj]
C:WINDOWSMicrosoft.NETFrameworkv4.0.30319Microsoft.Common.targets(847,9): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.0" 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. [D:adismercuryAdisFeedscacheAdis.Feeds.Cache.ConsoleManagerAdis.Feeds.Cache.ConsoleManager.csproj]
问题是我已经安装了 windows SDK 7.1 的 .NET 部分....我特别小心地选中了 .net 4.0 参考程序集旁边的框.
The problem is that I have already installed the .NET parts of the windows SDK 7.1. ... I was especially careful to check the box next to the .net 4.0 reference assemblies.
有人对出了什么问题有任何建议吗?
Does anyone have any suggestions as to what's going wrong?
为了记录,我使用 Nant 为 msbuild nant 任务运行构建脚本(0.86 版)和 nant.contrib (0.85).
For the record I am using Nant to run the build scripts (ver 0.86) and nant.contrib (0.85) for the msbuild nant task.
更新我只是从那个角度往下跑.我使用 msbuild 编译了解决方案,并在我的开发机器上进行了诊断日志记录,然后在构建服务器上再次编译.然后我比较了日志.
Update I was just running down that angle. I compiled the solution using msbuild with diagnostic logging on my dev machine and then again on the build server. Then I compared the logs.
似乎显着的区别在于缺少对 Program FilesReferences Assemblies 路径的任何引用.特别是在 FrameworkPathOverride 中.
Seems the significant difference there is the lack of any references to the Program FilesReferences Assemblies path. Specifically in FrameworkPathOverride.
所以我尝试将 FrameworkPathOverride 作为命令行参数添加到 msbuild.不幸的是,这只是让我不幸地发现,参考程序集目录中似乎只有 xml 文件.因为只有 mscorlib.xml.没有 mscorlib.dll
So I tried adding FrameworkPathOverride as a commandline parameter to msbuild. Unfortunately that just led me to the unfortunate discovery that the reference assemblies directories only seem to have the xml files in them. As in there is only mscorlib.xml. No mscorlib.dll
这到底是怎么回事?!?
What the heck is going on?!?
推荐答案
好的,我找到了一个可行的解决方案.你需要做两件事:
Ok I found a solution that works. You need to do two things:
- 首先将 FrameworkPathOverride 添加为命令行参数,并将其指向引用程序集目录.
有点像
msbuild -p:FrameworkPathOverride="C:Program FilesReference AssembliesMicrosoftFramework.NETFrameworkv4.0"
- 您需要做的第二件事是找到参考程序集目录的完整版本.由于windows SDK安装的副本和visual studio安装的副本,我只是从我的开发机器上复制了我的.工作正常.
最后一点:这可能首先发生在我身上的原因是我们的构建服务器是一个不错的旧 Windows Server 2003 版本.Windows SDK 安装太旧无法应付?
One final note: the reason this might have happened to me in the first place is that our build server is a nice old windows server 2003 one. Too old for the windows SDK install to cope with?
这篇关于.NET 4.0 构建服务器引用程序集警告 MSB3644的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!