Build apps against Microsoft.NETFramework.ReferenceAssemblies

Neo 421 Reputation points
2023-04-30T15:58:02.93+00:00

When I try to download .NET Framework v4.0 devpack, I amd directed to Build apps against Microsoft.NETFramework.ReferenceAssemblies.

I added package.config as outlined in the doc:

<packages>
  <package id="Microsoft.NETFramework.ReferenceAssemblies" version="1.0.3" developmentDependency="true" />
</packages>

Then I build my project so that the packge is restored. But there is no v4.0 in the list of target framework in project Properties. I also tried manually edit project.csproj file by setting TargetFrameworkVersion>v4.0</TargetFrameworkVersion> but I cannot open the project and I was prompted by VS to upgrade to v4.8 or download devpack for 4.0.

That's frustrating. How should I do?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,779 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiachen Li-MSFT 30,931 Reputation points Microsoft Vendor
    2023-05-01T02:38:25.19+00:00

    Hi,

    Try the following steps.

    Install Microsoft.NETFramework.ReferenceAssemblies.net40.

    User's image

    Restore NuGet packages:

    msbuild /t:restore

    Build the project:

    msbuild

    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.


1 additional answer

Sort by: Most helpful
  1. Vahid Ghafarpour 21,080 Reputation points
    2023-04-30T16:40:02.33+00:00

    If you are specifically looking for the .NET Framework v4.0 development pack, you can download it directly from the Microsoft Download Center by searching for ".NET Framework 4.0 Developer Pack" or by using the following link: https://www.microsoft.com/en-us/download/details.aspx?id=24826

    If you have already added the "Microsoft.NETFramework.ReferenceAssemblies" package to your project and it is not showing the .NET Framework v4.0 as a target framework, you may need to check your project settings to make sure it is set up correctly.

    To do this, open the project properties in Visual Studio, and under the "Application" tab, make sure that the "Target framework" drop-down list is set to ".NET Framework 4" or ".NET Framework 4.0".

    If you are still experiencing issues with your project, you may want to consider upgrading to a newer version of the .NET Framework, as the v4.0 has reached end of support and may not be fully compatible with the latest version of Visual Studio.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.