Error MSB364 using VS 2022 to build Gen .NET C# applications
search cancel

Error MSB364 using VS 2022 to build Gen .NET C# applications

book

Article ID: 276487

calendar_today

Updated On:

Products

Gen Gen - Run Time Distributed Gen - Workstation Toolset

Issue/Introduction

When trying to build a Gen .NET C# application with Visual Studio 2022 you will receive:

error MSB3644: 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

Environment

Gen Build Tool using Visual Studio 2022.

Cause

Visual Studio 2022 no longer delivers .NET Framework 4.0. Building Gen generated C# code will result in the above error regardless of the value used for Build Tool OPTIONS token OPT.VSVERSION.

Resolution

There is currently no resolution.

Workaround:

If you intend to build C# applications with a Visual Studio 2022 installation, you will need to install the following individual component from the Visual Studio 2019 installation:

  • .NET Framework 4 targeting pack