Click here to Skip to main content
15,901,373 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have .NET 4.72 ASMX Web Service that references a .Net Standard 2.0 class library with the Entity Framework

I am using Visual Studio 2022

Everything works fine when I work with the code locally. Everything successfully compiles and runs

However, when I try to push the code to a GIT repository, the code fails. It gives me this error

error MSB4019: The imported project "/usr/share/dotnet/sdk/7.0.305/Microsoft/VisualStudio/v17.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "/usr/share/dotnet/sdk/7.0.305/Microsoft/VisualStudio/v17.0/WebApplications/Microsoft.WebApplication.targets" is correct, and that the file exists on disk.<br />

I tried to remove all those targets references from my proj file, but the VS adds this line automatically

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" />

If I force this targets reference out of the proj file, I will get a different error

error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at<br />

What can I do to successfully push the code to GitHub

Thank you in advance

What I have tried:

I also tried to copy target files locally in the project folder and reference them from there

Also, I tried to use

<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />

Instead of

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" />

Nothings works
Updated 4-Jul-23 14:15pm

1 solution

The reference assemblies for .NETFramework,Version=v4.7.2 were not found.

This sounds to me that you have an issue with framework versioning.

Try the following by using the "Visual Studio Installer":
1. select VS2022 installed > Modify > Individual Components. No untick both the .Net Framework targeting pack and SDK. finish the update.
2. repeat but this time tick both, then finish the update.

This should refresh the SDKs. Now undo the changed made as mentioned above. Lastly, retry pushing.
Share this answer
Member 13304618 7-Jul-23 20:33pm    
After an extensive research I came to a realization that I might to update the build_check.yaml file for a solution. Currently it accounts for the .NET Core. Should I update it in some specific way to account for the .Net Framework 4.7.2?

Here are the contents of the yaml file that I currently have

name: Build check


name: Build check
runs-on: ubuntu-latest
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
dotnet-version: |
- 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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900