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

8

34

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

Flamboyant answered 3/5, 2011 at 23:37 Comment(2)
Well, are they present? C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0. Watch out for 64-bit operating system hassles, they also have c:\program files (x86)Trilly
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.Flamboyant
F
33

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?

Flamboyant answered 10/5, 2011 at 20:32 Comment(5)
...yes you did! thanks. have a Server 2008 R1 machine which won't let me install Win 8 SDK or Visual Studio 2012Contradistinction
Had 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!Lyon
I 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.Hiltan
I 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"Frieder
On 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"Swig
G
12

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.

Gluttonous answered 19/11, 2011 at 20:49 Comment(1)
Use the Web installer from here microsoft.com/en-us/download/confirmation.aspx?id=8279 to avoid the download of the whole SDK.Sanhedrin
S
2

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 :-)

Sessions answered 24/8, 2012 at 10:25 Comment(0)
P
1

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

Parachute answered 6/3, 2017 at 1:14 Comment(1)
you can even use mklink to create a sym link instead of copyingLora
B
0

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

Blouse answered 2/7, 2015 at 7:26 Comment(0)
P
-1

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.

In my case, I was attempting to 'start without debugging' a new ASP.Net Core Web Application (.NET Core) created to follow the tutorial at: 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.

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.

Pentastyle answered 29/9, 2016 at 3:22 Comment(1)
This question is strictly about .NET Framework 4.0, not 4.5.x.Faircloth
T
-1

Make sure you've installed .NET Framework Developer Pack, not a regular package.

If you're using Visual Studio, Code or other IDE, you should also install a .NET Targeting Pack.

Downloads page: https://www.microsoft.com/net/download

Related:

Tuppeny answered 10/9, 2018 at 11:23 Comment(1)
None of those covers .NET Framework 4.0 referenced assemblies.Faircloth
T
-1

Because both .Net 4.0 and .Net 4.5 use CLR 4 and .NET 4.5 is an in-place replacement for .NET 4.0, you can safely apply the next solution:

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.

I created a symbolic link to this folder.

  1. Run command prompt as an administrator.

  2. Run the following script:

    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

Note: This solution is not a hack for net4,because I introduced why this solution is safe, i provide excerpt from .NET 4.5 is an in-place replacement for .NET 4.0:

When .NET 4.5 is installed it effectively replaces .NET 4.0 on the machine. .NET 4.0 gets overwritten by a new version of .NET 4.5 which - according to Microsoft - is supposed to be 100% backwards compatible.

When you install .NET 4.5 your .NET 4.0 assemblies in the \Windows.NET Framework\V4.0.30319 are overwritten with a new set of assemblies. You end up with overwritten assemblies as well as a bunch of new ones.

If you open the properties of System.dll assembly in .NET 4.5 you'll also see: Notice that the file version is also left at 4.0.xxx.

This solution is like my own except it copies the assemblies from net45 to net4.

See also.NET Versioning and Multi-Targeting - .NET 4.5 is an in-place upgrade to .NET 4.0 Note: Net 4 life time is ended, it is better to upgrade to net 4.5.2

Tactic answered 28/4, 2019 at 3:53 Comment(4)
Too hacky to go this way, and also you created an invalid .NET Framework 4.0 profile (as 4.5 has more APIs).Faircloth
@LexLi, I updated my answer to show that the solution is safe not a hacky one.Tactic
No. 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, learn.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.Faircloth
Net4 life time is ended.Tactic

© 2022 - 2024 — McMap. All rights reserved.