Forum Discussion
How can I add .NET Framework 4.7.2 to a build_check.yml that accounts only for the .NET Core
I have a .NET solution that have several projects, built in .NET Core and in the .NET 4.7.2. All those projects are built and run fine on my local environment.
However, when I push this solution to a GitHub, the build in the GitHub fails
error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found.
I examined the build_check.yml uploaded to GitHub, and noticed that this file is missing a reference to a .NET Framework 4.7.2.
I am posting the contents of the build_check.yml below. What is the right syntax to add .NET Framework 4.7.2 to it?
I have a .NET solution that have several projects, built in .NET Core and in the .NET 4.7.2. All those projects are built and run fine on my local environment.
However, when I push this solution to a GitHub, the build in the GitHub fails
error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found.
I examined the build_check.yml uploaded to GitHub, and noticed that this file is missing a reference to a .NET Framework 4.7.2.
I am posting the contents of the build_check.yml below. What is the right syntax to add .NET Framework 4.7.2 to it?
name: Build check on: pull_request: jobs: test: name: Build check runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: dotnet-version: | 6.0.x 7.0.x - name: Restore packages for solution run: dotnet restore - name: Build solution run: dotnet build --no-restore -c debug # - name: Run tests # run: dotnet test --no-build -c debug
2 Replies
- bobodenkirk1Copper Contributor
Hi MikhailPodolski,
The error you're encountering indicates that the reference assemblies for .NET Framework 4.7.2 are missing in the GitHub Actions environment. This is because your workflow configuration is currently set up to use only .NET Core.
To resolve this issue and build your projects targeting both .NET Core and .NET Framework, you'll need to make a few adjustments to your workflow file. Here's how you can modify your `build_check.yml`:
```yaml name: Build check on: pull_request: jobs: test: name: Build check runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup .NET Core uses: actions/setup-dotnet@v2 with: dotnet-version: 6.0.x - name: Restore packages for solution run: dotnet restore - name: Build solution (NET Core) run: dotnet build --no-restore -c debug - name: Setup .NET Framework uses: actions/setup-dotnet@v2 with: dotnet-version: 4.7.2 - name: Build solution (NET Framework) run: msbuild YourSolution.sln /p:Configuration=Debug # Uncomment these lines if you want to run tests # - name: Run tests (NET Core) # run: dotnet test --no-build -c debug # - name: Run tests (NET Framework) # run: vstest.console.exe YourTestProject.dll ```In this modified configuration, I've added two sections to the workflow: one for building with .NET Core and another for building with .NET Framework 4.7.2. Make sure to replace `YourSolution.sln` and `YourTestProject.dll` with the actual names of your solution and test project files.
You might need to make sure the required SDKs for .NET Core and .NET Framework are available in your workflow. You can refer to the documentation for `setup-dotnet` to learn more about specifying custom SDK versions or installing missing ones: https://learn.microsoft.com/en-us/dotnet/core/install/windows?tabs=net70http://miportalfones.com/ and https://github.com/actions/setup-dotnet
You will know how to: Install the SDK
The .NET SDK allows you to develop apps with .NET. If you install the .NET SDK, you don't need to install the corresponding runtimes. To install the .NET SDK, run the following command:
Windows Command PromptCopywinget install Microsoft.DotNet.SDK.7 - shazmaafzalCopper Contributor
Hi MikhailPodolski,
The error you're encountering indicates that the reference assemblies for .NET Framework 4.7.2 are missing in the GitHub Actions environment. This is because your workflow configuration is currently set up to use only .NET Core.
To resolve this issue and build your projects targeting both .NET Core and .NET Framework, you'll need to make a few adjustments to your workflow file. Here's how you can modify your build_check.yml:name: Build check on: pull_request: jobs: test: name: Build check runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup .NET Core uses: actions/setup-dotnet@v2 with: dotnet-version: 6.0.x - name: Restore packages for solution run: dotnet restore - name: Build solution (NET Core) run: dotnet build --no-restore -c debug - name: Setup .NET Framework uses: actions/setup-dotnet@v2 with: dotnet-version: 4.7.2 - name: Build solution (NET Framework) run: msbuild YourSolution.sln /p:Configuration=Debug # Uncomment these lines if you want to run tests # - name: Run tests (NET Core) # run: dotnet test --no-build -c debug # - name: Run tests (NET Framework) # run: vstest.console.exe YourTestProject.dllIn this modified configuration, I've added two sections to the workflow: one for building with .NET Core and another for building with .NET Framework 4.7.2. Make sure to replace YourSolution.sln and YourTestProject.dll with the actual names of your solution and test project files.
You might need to make sure the required SDKs for .NET Core and .NET Framework are available in your workflow. You can refer to the documentation for setup-dotnet to learn more about specifying custom SDK versions or installing missing ones: https://github.com/actions/setup-dotnet.