79688238

Date: 2025-07-03 02:32:16
Score: 1.5
Natty:
Report link

Since July 2025, GitHub actions stopped supporting windows-2019 runner, so I encountered the same problem. I found a solution from Open .net framework 4.5 project in VS 2022. Is there any workaround?

The key steps are as follows:

  1. Download .net framework 4.5 SDK from NuGet.org
  2. Unzip and move .net framework 4.5 SDK to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework

GitHub action example:

name: test

on:
  workflow_dispatch:
  push:
    branches: ['main']

jobs:
  build:
    env:
      projName: net45action
      buildCfg: Release
      net45SdkUrl: 'https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net45/1.0.3'
      sdkSystemPath: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework'

    runs-on: windows-2025

    steps:
      - name: Install .net framework 4.5 SDK
        shell: pwsh
        run: |
          echo "download ${env:net45SdkUrl}"
          Invoke-WebRequest -Uri "${env:net45SdkUrl}" -OutFile "net45sdk.zip"
          echo "unzip net45sdk.zip"
          Expand-Archive -Force -LiteralPath "net45sdk.zip" -DestinationPath "net45sdk"
          echo "move to ${env:sdkSystemPath}"
          Move-Item -Force -LiteralPath "net45sdk\build\.NETFramework\v4.5" -Destination "${env:sdkSystemPath}"

      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Add msbuild to PATH
        uses: microsoft/setup-msbuild@v2

      - name: Setup VSTest Path
        uses: darenm/[email protected]

      - name: Restore packages
        run: nuget restore ${env:projName}.sln

      - name: Build
        run: msbuild ${env:projName}.sln -p:Configuration=${env:buildCfg}

      - name: Run unit tests
        run: vstest.console.exe "${{ env.projName}}.test\bin\${{ env.buildCfg }}\${{ env.projName}}.test.dll"
        

Here is an example project:
https://github.com/vrnobody/net45action

Reasons:
  • Blacklisted phrase (1): Is there any
  • Contains signature (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: nobody