dotnet / project-system

The .NET Project System for Visual Studio
MIT License
971 stars 389 forks source link

Building only dotnet core packages / available rids on MacOS / liunx #1586

Closed niemyjski closed 7 years ago

niemyjski commented 7 years ago

So with the Foundatio project and our other projects (https://github.com/exceptionless/foundatio) we target .net core/standard as well full framework. What I'd like to happen is if you are on an operating system that doesn't support the full framework we only build the core/standard targets..

I know that we can do this partially with msbuild conditionals which I haven't yet fully looked into. But how do you do it if you have a project that only supports the full framework? I want the solution to build without error but I want it to completely skip a project of which the runtime is not (yet) supported.

davkean commented 7 years ago

There's not a way out-of-the-box to do what you are after, you can't conditionally build a project if you are calling MSBuild on the solution. What I've seen other projects do, is to:

  1. Have two solutions; one that represents the projects you build on Windows, and one that represents the projects you build cross-platform. This is what Roslyn does with CrossPlatform.sln and Roslyn.sln.

  2. Having a custom build script that simply calls MSBuild on the projects you want build cross-platform. You could do that in a script or call MSBuild task yourself, similar to: https://github.com/dotnet/roslyn-project-system/blob/master/build/build.proj#L46.

Alternatively, you could write a custom targets file that you import that overrides the Build target to do nothing for full framework projects when on a platform other than Windows.

srivatsn commented 7 years ago

This is tracked by https://github.com/dotnet/sdk/issues/826