1
votes

I have vs 2013, 2015 and 2017 installed. I am building a powershell project for 2015 .NET 4.7.1 to do a very specific type of deployment. I am executing the following commands. $Configuration is either 'Release' or 'Debug'.

dotnet msbuild /t:rebuild /p:Configuration=$Configuration /p:Platform=x64

..... I keep getting the following error: error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.4\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. That does NOT exist on disk.
Where do I get it?
It appears to be looking for .NET core, but my project is NOT .NET core. My project is .NET standard. I also tried using /t (tools version) but no matter what I put, I get the same error.

1

1 Answers

0
votes

The dotnet CLI (".NET Core SDK") does not support building non-"SDK" project types, which is classic csproj files and classic web applications.

While some classic csproj files may work (esp. logic-only libraries), it does not work for many other project types, which expect VS-only files to be present (such as Microsoft.WebApplication.targets).

Use the msbuild.exe of the visual studio installation to build these projects. Best to launch the developer command prompt of the visual studio version you need and run (powershell and then) msbuild from there.

If you need to run this in a build script, use vswhere to locate msbuild.exe of the VS / Build Tools 2017 installation.