.NET SDK "NETSDK1141: unable to resolve framework reference" in CI
NETSDK1141 means a FrameworkReference (the ASP.NET Core shared framework, Windows Desktop, etc.) cannot be resolved for the target version because the matching shared framework pack is not installed alongside the SDK on the runner.
What this error means
The build fails with NETSDK1141 naming the framework reference and version it could not resolve. It reproduces until the right SDK/pack is present.
error NETSDK1141: Unable to resolve the .NET 9.0-windows reference
Microsoft.WindowsDesktop.App. The targeting pack may not be installed.Common causes
The shared framework pack is missing for the TFM
The project references ASP.NET Core or Windows Desktop for a version whose targeting/runtime pack the installed SDK does not include.
Wrong SDK installed for the framework reference
Only the base .NET SDK is present, but the project needs the ASP.NET Core or desktop workload/pack for that version.
How to fix it
Install the matching SDK and pack
- Install the SDK version that bundles the needed shared framework (setup-dotnet installs ASP.NET Core packs with the SDK).
- For Windows Desktop, build on a Windows runner with the desktop pack available.
- Confirm the
FrameworkReferenceversion aligns with the installed packs, then rebuild.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'How to prevent it
- Match the runner SDK and OS to the framework references the project uses.
- Keep TFM and FrameworkReference versions consistent across projects.