Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET 4.0 build server reference assemblies warnings MSB3644 [duplicate]

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?!?

like image 988
Jero Avatar asked May 03 '11 23:05

Jero


People also ask

How do you fix msb3971?

This error occurs when you're building for . NET 5 or later, but you're using an older version of the . NET SDK. This issue can usually be resolved by upgrading to a newer version of your build tools.

What are .NET reference assemblies?

Reference assemblies are usually distributed with the Software Development Kit (SDK) of a particular platform or library. Using a reference assembly enables developers to build programs that target a specific library version without having the full implementation assembly for that version.

Where are .NET assemblies stored?

NET Framework 4, the default location for the Global Assembly Cache is %windir%\Microsoft.NET\assembly. In earlier versions of the . NET Framework, the default location is %windir%\assembly. Administrators often protect the systemroot directory using an access control list (ACL) to control write and execute access.


2 Answers

Ok I found a solution that works. You need to do two things:

  1. 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" 
  1. 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?

like image 89
Jero Avatar answered Sep 21 '22 08:09

Jero


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.

like image 34
cixelsyd Avatar answered Sep 20 '22 08:09

cixelsyd