Where to download from and install .NET Framework 4.0?

I tried to re target the application to .net 4.8 but then keep getting the error when compiling.

I have a project in c# winforms not my project and it’s old and when I try to compile it I’m getting this error.

Severity Code Description Project File Line Suppression State
Error The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks TestApp

I browsed to the site: https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?cid=msbuild-developerpacks

but when I’m looking the .net 4.0 there is no download link.

.net 4 developer pack but no download link

>Solution :

You have this error:

The reference assemblies for .NETFramework,Version=v4.0 were not found.

(emphasis mine)

Now I do see a link for the 4.0 reference assemblies in that screen shot, but it takes you to a page with no download. However, the very first sentence in the page is this:

When you target a particular version of .NET Framework, by default your application is built by using the reference assemblies that are included with that version’s developer pack.

What’s going on here is all versions of .Net Framework 4.0 and later share the same basic runtime, and so you’ll always see the "4.0" in that error message regardless of what specific 4.0-series version you’re actually using. However, because of minor updates or changes to implementation details, the reference assemblies with each version may be slightly different.

Therefore, if you’re targeting (say) .Net 4.8.1, you also need the developer pack for 4.8.1, which will include the correct 4.0 runtime reference assemblies you want.

Leave a Reply