The reference assemblies for .NETFramework, Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeing Pack) for this framework version or retarget your appliation.

Gui, Feng 21 Reputation points
2022-04-05T22:12:09.997+00:00

I installed Visual Studio Enterprise 2022 64 bit Version 17.1.3 on Windows 10 21H2 and with Python 3.9.12 installed under C:\Python\Python39_64.

I created a project via "Python Application". As soon as I created this project, I ended up with this Error.

The reference assemblies for .NETFramework, Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeing Pack) for this framework version or retarget your appliation. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developpacks

I downloaded .Net Framework v4.8 Developer Pack as recommended and installed it.

I looked into C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework

I see v4.0, v4.5, v4.5.1, v4.5.2, v4.6, v4.6.1, v4.7.2, v4.8, v4.X

However, in C:\Program Files\Reference Assemblies\Microsoft\Framework

I only see v3.0, v3.5

The .Net Framework v4.8 Developer Pack only installed v4.8 under C:\Program Files (x86), not in C:\Program Files.

The error remains.

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,119 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Jordan Werner 11 Reputation points
    2022-05-10T17:36:09.03+00:00

    The response above did not fix this error for me

    2 people found this answer helpful.

  2. Michael Cheers 6 Reputation points
    2022-09-14T01:30:46.377+00:00

    Adding this worked for me:

    <PropertyGroup>  
      <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>  
      <TargetFrameworkMoniker>.NETFramework,Version=$(TargetFrameworkVersion)</TargetFrameworkMoniker>  
    </PropertyGroup>  
    

    Source: https://github.com/microsoft/PTVS/issues/6747#issuecomment-1015704916

    1 person found this answer helpful.
    0 comments No comments

  3. Jiachen Li-MSFT 26,506 Reputation points Microsoft Vendor
    2022-04-06T09:49:29.257+00:00

    Hi @Gui, Feng ,
    See if installing the packages below helps you.
    https://www.microsoft.com/en-us/download/details.aspx?id=17718
    https://dotnet.microsoft.com/en-us/download/dotnet-framework/net48
    Best Regards.
    Jiachen Li

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments