.NET 4.0 构建服务器参考程序集警告 MSB3644
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5876946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
.NET 4.0 build server reference assemblies warnings MSB3644
提问by Jero
I'm getting a bunch of errors on my build server:
我的构建服务器上出现一堆错误:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.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:\adis\mercury\AdisFeeds\cache\Adis.Feeds.Cache.ConsoleManager\Adis.Feeds.Cache.ConsoleManager.csproj]
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(847,9):警告 MSB3644:未找到框架“.NETFramework,Version=v4.0”的参考程序集。要解决此问题,请为此框架版本安装 SDK 或 Targeting Pack,或者将您的应用程序重新定位到安装了 SDK 或 Targeting Pack 的框架版本。请注意,程序集将从全局程序集缓存 (GAC) 中解析,并将用于代替引用程序集。因此,您的程序集可能没有正确针对您想要的框架。[D:\adis\mercury\AdisFeeds\cache\Adis.Feeds.Cache.ConsoleManager\Adis.Feeds.Cache.ConsoleManager.csproj]
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.
问题是我已经安装了 windows SDK 7.1 的 .NET 部分。...我特别小心地选中了 .net 4.0 参考程序集旁边的框。
Does anyone have any suggestions as to what's going wrong?
有没有人对出了什么问题有任何建议?
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.
作为记录,我使用 Nant 为 msbuild nant 任务运行构建脚本(版本 0.86)和 nant.contrib(0.85)。
UpdateI 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.
更新我只是跑下那个角度。我在我的开发机器上使用 msbuild 和诊断日志编译了解决方案,然后在构建服务器上再次编译。然后我比较了日志。
Seems the significant difference there is the lack of any references to the \Program Files\References Assemblies path. Specifically in FrameworkPathOverride.
似乎显着的区别是缺少对 \Program Files\References Assemblies 路径的任何引用。特别是在 FrameworkPathOverride 中。
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
所以我尝试将 FrameworkPathOverride 作为命令行参数添加到 msbuild。不幸的是,这让我不幸地发现,参考程序集目录中似乎只有 xml 文件。因为只有 mscorlib.xml。没有 mscorlib.dll
What the heck is going on?!?
到底他妈发生了什么?!?
采纳答案by Jero
Ok I found a solution that works. You need to do two things:
好的,我找到了一个有效的解决方案。你需要做两件事:
- First add FrameworkPathOverride as a commandline parameter and point it to the references assemblies directory.
- 首先添加 FrameworkPathOverride 作为命令行参数并将其指向引用程序集目录。
Something like
就像是
msbuild -p:FrameworkPathOverride="C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
- The second thing you need to do is find a full version of the reference assemblies directory. Since the copy installed by the windows SDK and the one installed by visual studio, I just copied mine from my development machine. Works fine.
- 您需要做的第二件事是找到参考程序集目录的完整版本。由于windows SDK安装的副本和visual studio安装的副本,我只是从我的开发机器上复制了我的。工作正常。
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?
最后一个注意事项:首先,这可能发生在我身上的原因是我们的构建服务器是一个很好的旧 Windows Server 2003 服务器。Windows SDK 安装太旧无法应付?
回答by cixelsyd
This looks like a dup of this question: .NET 4.0 build issues on CI serverand in any event should be solved in the manner prescribed there.
这看起来像是这个问题的重复:CI 服务器上的 .NET 4.0 构建问题,无论如何都应该以那里规定的方式解决。
Make sure the windows 7 SDK is installed with (at a minimum) both the .NET Development "Intellisense and Reference Assemblies" and "Tools." If they say they are already installed, yet the reference assemblies do not exist on your disk, then uninstall and reinstall. I have confirmed the fix on my build server.
确保 Windows 7 SDK 与(至少).NET Development“Intellisense and Reference Assemblies”和“Tools”一起安装。如果他们说它们已经安装,但参考程序集在您的磁盘上不存在,则卸载并重新安装。我已经确认了我的构建服务器上的修复。
回答by Torben Vesterager
To add to cixelsyd's answer:
添加到 cixelsyd 的答案中:
The default setting in the Windows SDK v7.1 installer is that "Intellisense and Reference Assemblies" is 'semi-checked' - change that to fully checked and the warnings are gone :-)
Windows SDK v7.1 安装程序中的默认设置是“智能感知和参考程序集”是“半检查” - 将其更改为完全检查并且警告消失:-)
回答by knguyen
This works for me, run it in powershell(without using FrameworkPathOverride):
这对我有用,在powershell 中运行它(不使用 FrameworkPathOverride):
cp -r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
It's because 4.5 (or 4.5.1) is a drop-in replacement for 4.0
这是因为 4.5(或 4.5.1)是 4.0 的替代品
回答by kenorb
Make sure you've installed .NET Framework Developer Pack, nota regular package.
请确保你已经安装了.NET Framework开发包,不是一个正规套餐。
If you're using Visual Studio, Code or other IDE, you should also install a .NET Targeting Pack.
如果您使用的是 Visual Studio、Code 或其他 IDE,则还应该安装.NET Targeting Pack。
Downloads page: https://www.microsoft.com/net/download
下载页面:https: //www.microsoft.com/net/download
Related:
有关的:
回答by M.Hassan
in the folder:
在文件夹中:
C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework
there are set of folders, one for every installed framework. The folder "v4.0" contain only xml files and folder "v4.5" contain both dll and xml files.
有一组文件夹,每个安装的框架一个。文件夹“v4.0”仅包含 xml 文件,文件夹“v4.5”包含 dll 和 xml 文件。
I created a symbolic link to this folder.
我创建了一个指向该文件夹的符号链接。
1) Run command prompt as an administrator.
1) 以管理员身份运行命令提示符。
2) Run the following script:
2) 运行以下脚本:
cd C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework
ren v4.0 v4.0_old
mklink /d v4.0 v4.5
A symbolic folder named "v4.0" is created and point to dlls of v4.5
一个名为“v4.0”的符号文件夹被创建并指向v4.5的dll
回答by KCT
Installation of SDK 8.1 (also for Windows 7) should also work in case of .net 4.5 requitements https://msdn.microsoft.com/en-US/windows/desktop/bg162891
安装 SDK 8.1(也适用于 Windows 7)也应该适用于 .net 4.5 要求https://msdn.microsoft.com/en-US/windows/desktop/bg162891
回答by PC Princess
After days of scouring the web for answers, looking extensively through project config files with reference assemblies mentioned, the above-mentioned advice to use Windows 8.1 SDK to re-install a missing 4.5.1 reference assembly finally did the trick.
经过数天在网上搜索答案,广泛查看包含参考程序集的项目配置文件,上述使用 Windows 8.1 SDK 重新安装丢失的 4.5.1 参考程序集的建议终于成功了。
In my case, I was attempting to 'start without debugging' a new ASP.Net Core Web Application (.NET Core) created to follow the tutorialat: https://docs.asp.net/en/latest/tutorials/first-mvc-app/start-mvc.html
在我的情况下,我试图“开始而不调试”一个新的 ASP.Net Core Web 应用程序 (.NET Core) 创建来遵循教程:https: //docs.asp.net/en/latest/tutorials/first -mvc-app/start-mvc.html
When using the SDK, I unchecked EVERYTHING accept for the reference assemblies. This was the only way I found to install 4.5.1 because other methods would fail due to the fact that I already had 4.5.2 and higher versions installed.
使用 SDK 时,我取消了参考程序集的所有接受。这是我发现安装 4.5.1 的唯一方法,因为其他方法会失败,因为我已经安装了 4.5.2 和更高版本。
Kudos to this page for the answer that finally worked!
感谢这个页面的答案终于奏效了!
warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5.1" 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.
警告 MSB3644:未找到框架“.NETFramework,Version=v4.5.1”的参考程序集。要解决此问题,请为此框架版本安装 SDK 或 Targeting Pack,或者将您的应用程序重新定位到安装了 SDK 或 Targeting Pack 的框架版本。

