Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade to .Net 4.5 causes assembly to fail?

I've got a project that targets .Net 4.0, and one of the referenced assemblies is .Net 4.5.

Until I installed .Net 4.5 this was working fine, however after the install I get five warnings regarding the targeted .Net version along these lines:

*The primary reference "xxxx.Library, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0"

And this:

The primary reference "Microsoft.TeamFoundation.Build.Workflow, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "Microsoft.TeamFoundation.Build.Workflow, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Tests

Why does Visual Studio hate me? If it could compile before the update to 4.5, the targeted framework has not changed and it still works for a colleague on VS2010 with .Net 4 why am I being stuffed?

like image 824
Dave Avatar asked May 31 '13 11:05

Dave


People also ask

Does installing .NET 4.0 will affect existing .NET applications?

No, they can exist alongside eachother. Just like with previous versions. In fact, 4.0 uses completely different directories to store its assemblies in.

Is .NET 4.5 still supported?

NET Framework 4.5. 2, 4.6, and 4.61 retired on April 26, 2022. These specific releases were previously signed using Secure Hash Algorithm (SHA-1) certificates. This algorithm is no longer secure.

Does .NET Framework 4.5 work on Windows 10?

NET 4.5. 1 cannot be installed on Windows 10, only 4.6 and later. So if your application is incompatible with .


2 Answers

The error message explains the problem - a .NET 4 app can't reference a .NET 4.5 dll. Change your app to .NET 4.5 as well, or change the dll back to .NET 4.

like image 141
thecoop Avatar answered Oct 16 '22 20:10

thecoop


It's because for reasons best known to Microsoft, the .NET Framework 4.5 is an in-place update that replaces your .NET Framework 4 files (rather than a side-by-side installation). If you look in C:\Windows\Microsoft.NET, you won't find a 4.5 folder--it replaced the files in your 4.0 folder.

So the reason it compiled before is that the dll was a .Net 4.0 dll then. Now it's been replaced by a 4.5 one.

like image 24
Reg Edit Avatar answered Oct 16 '22 22:10

Reg Edit