|
| 1 | +id: re-435 |
| 2 | +title: 'MSB3644: .NETFramework v4.0/v4.5/v4.5.1/v4.6.1 reference assemblies not |
| 3 | + found after migrating from windows-2019 to windows-2022/2025 runner' |
| 4 | +category: runner-environment |
| 5 | +severity: error |
| 6 | +tags: |
| 7 | + - windows |
| 8 | + - dotnet |
| 9 | + - msbuild |
| 10 | + - netframework |
| 11 | + - targeting-pack |
| 12 | + - windows-2022 |
| 13 | + - windows-2025 |
| 14 | + - windows-2019 |
| 15 | + - msb3644 |
| 16 | +patterns: |
| 17 | + - regex: 'MSB3644' |
| 18 | + flags: 'i' |
| 19 | + - regex: 'reference assemblies.*\.NETFramework.*Version.*v4\.(0|5|5\.1|6\.1).*not found' |
| 20 | + flags: 'i' |
| 21 | + - regex: 'NETFramework.*v4\.(0|5|5\.1|6\.1).*reference assemblies.*not found' |
| 22 | + flags: 'i' |
| 23 | + - regex: 'install the Developer Pack.*SDK.*Targeting Pack.*this framework' |
| 24 | + flags: 'i' |
| 25 | +error_messages: |
| 26 | + - "Error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 were not |
| 27 | + found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this |
| 28 | + framework version or retarget your application." |
| 29 | + - "Error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 were not |
| 30 | + found." |
| 31 | + - "Error MSB3644: The reference assemblies for .NETFramework,Version=v4.5.1 were |
| 32 | + not found." |
| 33 | + - "Error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.1 were |
| 34 | + not found." |
| 35 | +root_cause: | |
| 36 | + The `windows-2019` GitHub Actions runner shipped with Visual Studio 2019, which |
| 37 | + included targeting packs for legacy .NET Framework versions (4.0, 4.5, 4.5.1, |
| 38 | + 4.6.1). When those targeting packs are installed, MSBuild can resolve reference |
| 39 | + assemblies for projects targeting those framework versions. |
| 40 | +
|
| 41 | + The `windows-2022` and `windows-2025` runners ship with Visual Studio 2022 or |
| 42 | + 2026, which does **not** include targeting packs for .NET Framework 4.0, 4.5, |
| 43 | + 4.5.1, or 4.6.1. The full list of packs **removed** between VS 2019 and VS 2022: |
| 44 | +
|
| 45 | + - `Microsoft.Net.Component.4.TargetingPack` (.NET 4.0) — removed |
| 46 | + - `Microsoft.Net.Component.4.5.TargetingPack` (.NET 4.5) — removed |
| 47 | + - `Microsoft.Net.Component.4.5.1.TargetingPack` (.NET 4.5.1) — removed |
| 48 | + - `Microsoft.Net.Component.4.6.1.TargetingPack` (.NET 4.6.1) — removed |
| 49 | +
|
| 50 | + .NET 4.5.2, 4.6, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 targeting packs ARE present |
| 51 | + in VS 2022/2026 (windows-2022 and windows-2025 runners). |
| 52 | +
|
| 53 | + This error surfaces most often when migrating legacy projects such as SSRS |
| 54 | + (SQL Server Reporting Services) reports, older WinForms/WPF applications, or |
| 55 | + Azure DevOps extensions that target .NET 4.0 or 4.5.x. |
| 56 | +
|
| 57 | + The error is hard to diagnose because `windows-latest` was previously pointing |
| 58 | + to `windows-2019` (with the packs), and the migration to `windows-2022` runner |
| 59 | + happened silently. |
| 60 | +fix: | |
| 61 | + **Option 1 (Recommended) — Retarget to .NET 4.5.2 or higher:** |
| 62 | + Update the `<TargetFrameworkVersion>` in your `.csproj` / `.vbproj` files to |
| 63 | + target `v4.5.2` or higher (e.g., `v4.8`), which are present on all modern |
| 64 | + Windows runners. This is the official recommendation from Microsoft. |
| 65 | +
|
| 66 | + **Option 2 — Install the .NET Framework Developer Pack in the workflow:** |
| 67 | + Download and install the missing targeting pack as a workflow step before |
| 68 | + running MSBuild. The Developer Packs are available from aka.ms/msbuild/developerpacks. |
| 69 | +
|
| 70 | + **Option 3 — Pin to `windows-2019` (temporary):** |
| 71 | + Pin your workflow to `runs-on: windows-2019` as a short-term workaround while |
| 72 | + you retarget. Note: windows-2019 is deprecated and will be removed — this is |
| 73 | + not a permanent solution. |
| 74 | +
|
| 75 | + **Option 4 — Use `choco` to install the targeting pack:** |
| 76 | + ``` |
| 77 | + choco install netfx-4.0-devpack --yes |
| 78 | + ``` |
| 79 | +fix_code: |
| 80 | + - language: yaml |
| 81 | + label: 'Broken — windows-2022 runner missing .NET 4.0 targeting pack' |
| 82 | + code: | |
| 83 | + jobs: |
| 84 | + build: |
| 85 | + runs-on: windows-2022 # VS 2022 does not include .NET 4.0 targeting pack |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v4 |
| 88 | + - name: Build |
| 89 | + run: msbuild MyProject.sln /p:Configuration=Release |
| 90 | + # → Error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 |
| 91 | + # were not found. |
| 92 | +
|
| 93 | + - language: yaml |
| 94 | + label: 'Fixed Option 1 — install Developer Pack before building' |
| 95 | + code: | |
| 96 | + jobs: |
| 97 | + build: |
| 98 | + runs-on: windows-2022 |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v4 |
| 101 | + - name: Install .NET Framework 4.0 Developer Pack |
| 102 | + shell: pwsh |
| 103 | + run: | |
| 104 | + $ProgressPreference = 'SilentlyContinue' |
| 105 | + # Download the .NET Framework 4 Developer Pack |
| 106 | + Invoke-WebRequest ` |
| 107 | + -Uri 'https://download.microsoft.com/download/F/1/2/F12768F8-F422-4462-8A1B-436A2C6C55D9/NDP40-KB2600211-x86-x64.exe' ` |
| 108 | + -OutFile net40devpack.exe |
| 109 | + Start-Process -Wait -ArgumentList '/quiet' net40devpack.exe |
| 110 | + - name: Build |
| 111 | + run: msbuild MyProject.sln /p:Configuration=Release |
| 112 | +
|
| 113 | + - language: yaml |
| 114 | + label: 'Fixed Option 2 — install via Chocolatey' |
| 115 | + code: | |
| 116 | + jobs: |
| 117 | + build: |
| 118 | + runs-on: windows-2022 |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v4 |
| 121 | + - name: Install .NET 4.0 targeting pack via Chocolatey |
| 122 | + shell: pwsh |
| 123 | + run: choco install netfx-4.0-devpack --yes --no-progress |
| 124 | + - name: Build |
| 125 | + run: msbuild MyProject.sln /p:Configuration=Release |
| 126 | +
|
| 127 | + - language: yaml |
| 128 | + label: 'Fixed Option 3 — retarget project to .NET 4.5.2 (available on all runners)' |
| 129 | + code: | |
| 130 | + # In your .csproj / .vbproj, change: |
| 131 | + # <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
| 132 | + # to: |
| 133 | + # <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
| 134 | + # .NET 4.5.2+ targeting packs are present on windows-2022 and windows-2025. |
| 135 | + jobs: |
| 136 | + build: |
| 137 | + runs-on: windows-2022 # ✓ .NET 4.5.2 targeting pack is present |
| 138 | + steps: |
| 139 | + - uses: actions/checkout@v4 |
| 140 | + - name: Build (retargeted project) |
| 141 | + run: msbuild MyProject.sln /p:Configuration=Release |
| 142 | +
|
| 143 | +prevention: |
| 144 | + - 'Before migrating from `windows-2019` to `windows-2022` or `windows-2025`, |
| 145 | + audit all `.csproj` files for `<TargetFrameworkVersion>` values below v4.5.2 |
| 146 | + and plan retargeting work.' |
| 147 | + - 'Search for `<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>` (and v4.5, |
| 148 | + v4.5.1, v4.6.1) in your repo before changing the runner image label.' |
| 149 | + - 'Use `windows-2022` explicitly rather than `windows-latest` to control when |
| 150 | + the runner image upgrade takes effect and avoid surprise breakage.' |
| 151 | + - 'Microsoft recommends targeting .NET Framework 4.8 for all new Windows desktop |
| 152 | + and web projects — it receives only security fixes but is fully supported.' |
| 153 | +docs: |
| 154 | + - url: 'https://github.com/actions/runner-images/issues/13502' |
| 155 | + label: 'actions/runner-images#13502: MSB3644 .NETFramework v4.0 reference assemblies |
| 156 | + not found after windows-2019 → windows-2022 migration' |
| 157 | + - url: 'https://aka.ms/msbuild/developerpacks' |
| 158 | + label: 'Microsoft: .NET Framework Developer Packs download page' |
| 159 | + - url: 'https://learn.microsoft.com/en-us/visualstudio/releases/2022/system-requirements#visual-studio-2022-net-framework-targeting-packs' |
| 160 | + label: 'Visual Studio 2022 .NET Framework targeting pack availability' |
| 161 | + - url: 'https://github.com/actions/runner-images/blob/main/images/windows/toolsets/toolset-2022.json' |
| 162 | + label: 'windows-2022 runner toolset: installed .NET components' |
0 commit comments