MSBuild "error MSB3644: reference assemblies not found" in CI
The project targets a .NET Framework version whose reference assemblies (targeting pack) are not installed on the runner. MSB3644 is common on Linux runners building net4x, which need Mono or the targeting pack.
What this error means
dotnet build fails with "error MSB3644: The reference assemblies for .NETFramework,Version=v4.8 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack)."
error MSB3644: The reference assemblies for .NETFramework,Version=v4.8 were not found.
To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version.Common causes
The targeting pack is not installed
Building a .NET Framework target needs its reference assemblies; a runner without that Developer Pack cannot find them.
A Linux runner building a net4x target
Linux images do not ship .NET Framework targeting packs, so net4x builds fail unless Mono or reference assemblies are added.
How to fix it
Build net4x on a Windows runner
Windows runners include the .NET Framework targeting packs; use one for net4x projects.
jobs:
build:
runs-on: windows-latestAdd reference assemblies on Linux
If you must build on Linux, add the reference assemblies package so MSBuild finds them.
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />How to prevent it
- Build .NET Framework targets on Windows runners.
- Add
Microsoft.NETFramework.ReferenceAssembliesfor Linux builds. - Keep targeting packs installed in custom images.