novotnyllc / MSBuildSdkExtras

Extra properties for MSBuild SDK projects
MIT License
347 stars 42 forks source link

Can't build with msbuild.sdk.extras on `dotnet build` #161

Open AArnott opened 5 years ago

AArnott commented 5 years ago

Now that we can target .NET Framework on Linux with dotnet build I decided to give it a go with vs-streamjsonrpc. But it fails to build with this error:

/home/andrew/.nuget/packages/msbuild.sdk.extras/2.0.24/Build/Workarounds.targets(27,5): error : If you are building projects that require targets from full MSBuild or MSBuildFrameworkToolsPath, you need to use desktop msbuild ('msbuild.exe') instead of 'dotnet build' or 'dotnet msbuild' [/home/andrew/git/vs-streamjsonrpc/src/StreamJsonRpc/StreamJsonRpc.csproj]

I don't understand why I'm hitting this. It seems to be unique to building the portable-net45+win8+wpa81 target framework, which is the only reason I need the MSBuild.Sdk.Extras in the first place.

Thoughts?

Repro steps:

git clone https://github.com/AArnott/vs-streamjsonrpc.git
cd vs-streamjsonrpc\src
git checkout 2bf2c7a985a1e323d96d8f14c1c506529c7dc278
dotnet build
dasMulli commented 5 years ago

The reference assemblies packages don't have reference assemblies for PCLs though, just .NET Framework.

There is a _SdkIgnoreMSBuildCoreWarning you could try. And maybe you could get the PCL to compile against a reference assembly by playing around with conditional AssetTargetFallback values, but that's probably (even more) dangerous waters..

AArnott commented 5 years ago

The reference assemblies packages don't have reference assemblies for PCLs though, just .NET Framework.

Thanks, @dasMulli. That makes sense as to why the build would fail, but the error message doesn't particularly help me discover that. Perhaps at least that can be improved. For now, I've successfully merged a similar change to our v2.0 version of vs-streamjsonrpc. Our v2.0 version had already dropped PCL support, so that made it easy.