問題描述
我的構建服務器出現一堆錯誤:
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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!