Azure Pipelines: MSB3644 "The reference assemblies for .NETFramework were not found"
To build a .NET Framework project, MSBuild needs the reference assemblies, the targeting pack, for that project's framework version on the agent. When the version is not there, the build stops with MSB3644. Microsoft-hosted Windows images come with packs for some versions only, and the Windows Server 2019 image, which many answers suggest, was retired on December 31, 2025 (Microsoft's page on hosted agents). Questions on Stack Overflow with this error in Azure DevOps have been seen over 140,000 times.
When the failing build is a pull request's build validation, the pull request waits on it: Azure DevOps Pull Requests, a plugin for JetBrains IDEs, lists the pull request's branch policies with their state in Rider, and with Pro runs a failed build policy again once the fix is pushed. Get it on JetBrains Marketplace
What it looks like
error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application.- In the .NET Core task, it comes before Dotnet command failed with non-zero exit code; in the Visual Studio Build or MSBuild task, before
Process 'msbuild.exe' exited with code '1'.
Which versions the hosted images have
From the Visual Studio components listed in each image's readme in the runner-images repository, which Azure Pipelines uses too:
windows-2022andwindows-2025(today alsowindows-latest): 4.5.2, 4.6, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 and 4.8.1.windows-2025-vs2026: 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 and 4.8.1, so no 4.5.2 and no 4.6. Microsoft sayswindows-latestwill point to this image, and thatwindows-2025will also move to Visual Studio 2026. A 4.5.2 or 4.6 project that builds onwindows-latesttoday will then hit MSB3644.- On none of them: 4.0, 4.5, 4.5.1 and 4.6.1, the version in the most common question.
Reference assemblies from NuGet
- The
Microsoft.NETFramework.ReferenceAssembliespackage brings the reference assemblies with the build, for .NET Framework 2.0 up to 4.8.1, so the agent needs no targeting pack. Add<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />to the project and restore before the build; this works for classic projects as well as SDK-style ones (the package's readme). A project that still usespackages.confighas to move toPackageReferencefirst. - An SDK-style project built with the .NET SDK gets this package by itself when the pack is missing, so MSB3644 comes mostly from classic projects, built with the Visual Studio Build or MSBuild task.
A newer target framework
- Support for .NET Framework 4.5.2, 4.6 and 4.6.1 ended on April 26, 2022 (Microsoft's announcement), which is why images drop them. Retargeting the project to 4.6.2 or later, ideally 4.8 or 4.8.1, makes it build on every hosted image, but is a change to test, not only to the build.
A self-hosted agent
- On your own agent, install the developer pack (or targeting pack) for the version, from Microsoft's .NET Framework downloads or with the Visual Studio installer, and restart the agent.
'.NETFramework,Version=v5.0'
- A version 5.0 or later in this message means a .NET 5 or later project is being built by an MSBuild or NuGet too old to know it, which reads
net5.0as .NET Framework. The accepted answer on the question about it: install the SDK withUseDotNet@2and build with the .NET Core task.
Azure DevOps pull requests in IntelliJ IDEA and Rider
Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, reads the organization, project and repository from your git remote and lists the pull requests that wait for your review in an IDE tool window, on Azure DevOps Services and on Azure DevOps Server. It shows the branch policies of a pull request with their state, so a required build that has not passed is next to its pull request, and with Pro you run a failed or expired build policy again from there. The review inbox is free; voting, commenting, completing and creating are Pro, with a 30-day trial.
Get it on JetBrains Marketplace
Azure DevOps, Azure Pipelines, .NET, .NET Framework and Visual Studio are trademarks of Microsoft Corporation; IntelliJ IDEA and Rider are trademarks of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft or JetBrains.
More: Dotnet command failed with non-zero exit code · the dotnet task matched no project · no agent satisfies the demands · 日本語