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.
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 https://aka.ms/msbuild/developerpacks
What can I do to successfully push the code to GitHub
Thank you in advance
The below solution is working for me, allowing me to build locally on my machine and my GitHub actions to run. Basically, make the Microsoft.WebApplication.targets available in the source.