VS 2017 dotnet publish fails in Team Foundation Services

We had an interesting problem after upgrading an ASP.Net Core project from project.json to VS 2017 csproj. The build broke. A little background...

The solution contains a portable library project. The build fails with the error...

error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.0.0\Microsoft\Portable\v4.5\Microsoft.Portable.CSharp.targets" was not found.

As it turns out, the new dotnet publish does not support framework libraries, only core and netstandard.

This wouldn't be so bad, if publish wasn't trying to do a build as well. The new tooling doesn't have the --no-build option prior to 2.1 being released.

To correct it, we followed the SO post above. We removed the dotnet publish step and added the publish switch to the msbuild arguments for the VisualStudio build step.

Vioala! working CICD pipeline again!


Questions, comments, concerns? Give us a Tweet!