.NET 4.0 build server reference assemblies warnings MSB3644
Solution 1
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.
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.
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?
Solution 2
This looks like a dup of this question: .NET 4.0 build issues on CI server and in any event should be solved in the manner prescribed there.
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.
Solution 3
To add to cixelsyd's answer:
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 :-)
Solution 4
This works for me, run it in powershell (without using 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
Jero
Updated on July 11, 2022Comments
-
Jero almost 2 years
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]
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?
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.
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.
Seems the significant difference there is the lack of any references to the \Program Files\References Assemblies path. Specifically in 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
What the heck is going on?!?
-
aruno over 11 years...yes you did! thanks. have a Server 2008 R1 machine which won't let me install Win 8 SDK or Visual Studio 2012
-
kzfabi over 11 yearsHad the same problem with .NET 4.5 Build running in a WS 2008 R2. Followed your comments and worked! The only thing that I didn't need was adding the commandline parameter. So just creating the 4.5 folder with the reference assemblies worked for me. Thanks a lot!
-
Dan almost 11 yearsI found this very helpful for .NET Framework v4 and v4.5 since the subfolders in the "Program Files\Reference Assemblies" path are not populated on 64-bit systems (only the "Program Files (x86)\Reference Assemblies" subfolders are populated). Thanks.
-
Oliver about 10 yearsUse the Web installer from here microsoft.com/en-us/download/confirmation.aspx?id=8279 to avoid the download of the whole SDK.
-
Dave Stuart over 7 yearsI was getting an error saying that .NET 3.5 SP1 was missing so adding the following parameter solved the issue. -p:FrameworkPathOverride="C:\Windows\Microsoft.NET\Framework\v2.0.50727"
-
O. Jones over 7 yearsOn Windows Server 2016, install the .NET Framework 4.6.2 Developer Pack. microsoft.com/en-us/download/details.aspx?id=53321 , then use
/p:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1"
-
Ivan over 6 yearsyou can even use
mklink
to create a sym link instead of copying -
Lex Li over 3 yearsNone of those covers .NET Framework 4.0 referenced assemblies.
-
Lex Li over 3 yearsToo hacky to go this way, and also you created an invalid .NET Framework 4.0 profile (as 4.5 has more APIs).
-
Lex Li over 3 yearsThis question is strictly about .NET Framework 4.0, not 4.5.x.
-
M.Hassan over 3 years@LexLi, I updated my answer to show that the solution is safe not a hacky one.
-
Lex Li over 3 yearsNo. Your edit didn't make it a valid answer. You didn't pay enough attention to facts that .NET Framework 4.5 does introduce significant new API surface, docs.microsoft.com/en-us/dotnet/framework/whats-new/… So by copying the referenced assemblies from 4.5 to 4.0, you effectively allows a .NET Framework 4.0 project to consume those new APIs, which is completely wrong/unsafe and violates the original goals of such referenced assemblies. That's why people should follow other answers. The "in-place upgrade" means something else and does not cover this specific spot.
-
M.Hassan over 3 yearsNet4 life time is ended.