Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I setup .NET Framework 4.6.1 for MSBuild on GitHub Actions?

When I use the latest setup-dotnet, I get an 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. You can download the .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

I tried both setup-dotnet but it says version 4.6.1 has been deprecated.

like image 372
3urjnjsdcxsa654 Avatar asked Jan 27 '26 09:01

3urjnjsdcxsa654


1 Answers

The windows-2022 runner does not include the targeting pack for 4.6.1 (since it is out of support). If using a windows-2019 runner is unacceptable you can download and install the targeting pack into the runner.

At the time of writing this works:

    - name: Download 461 targeting pack
      uses: suisei-cn/actions-download-file@818d6b7dc8fe73f2f924b6241f2b1134ca1377d9 # 1.6.0
      id: downloadfile  # Remember to give an ID if you need the output filename
      with:
          url: "https://download.microsoft.com/download/F/1/D/F1DEB8DB-D277-4EF9-9F48-3A65D4D8F965/NDP461-DevPack-KB3105179-ENU.exe"
          target: public/

    - name: Install targeting pack
      shell: cmd
      working-directory: public
      run: NDP461-DevPack-KB3105179-ENU.exe /q
like image 85
Naylor Avatar answered Jan 30 '26 04:01

Naylor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!