dotnet / dotnet/project-system

Cannot use net5.0 and net5.0-windows together.

Open
#6,927 4 comments 0 reactions 0 assignees View on GitHub
Needs-Spec Triage-Investigate
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

**Visual Studio Version**: VS2019 Latest Preview

**Summary**:
When trying to use net5.0; and net5.0-windows to make a dummy project file (has no targets) that exists only to generate a nuspec to make an metapackage using the projects to package inside (as dependencies) using ``ProjectReference`` based on conditions on each like so:
- does the project need at least net45 or newer?
- does the project need at least net461 or newer?
- does the project need at least netcoreapp2.0 or newer?
- does the project need at least netcoreapp3.0 or newer?
- does the project need at least netcoreapp3.1 or newer?
- does the project need at least net5.0 or newer (does not depend on os specific stuff)?
- does the project need at least net5.0-windows or newer (uses winforms or wpf)?
- does the project need at least netstandard2.0 or newer?
- does the project need at least netstandard2.1 or newer?

All of those above are the conditions on it all, however currently the project system only allows 1 net5.0 and it ignores the others.

**Steps to Reproduce**:

1. make a project or a few of them and target net40;core2.0;standard2.0 on some, on others use compression apis only from net45;core2.0;standard2.0; and on some other ones also use System.Text.Json on net461;core2.0;core3.0;core3.1;net5;netstandard2.0&2.1, and finally make a project using winforms or wpf.

2. Now create a project with no targets (solely to generate a nuspec to turn it all into a metapackage), have all of the TFM's of the on all of the other packages combined into it, then project reference them all into that dummy project.

3. create an props file, possibly also an targets file that would also be imported by nuget when the package is installed and add those into the project file (to tell it that they need to be packed into the nuget package).

4. Notice that the above would not work at all, it just blows up on you in the end.

**Expected Behavior**:
To be able to do this to have the .NET SDK to generate the nuspec automatically instead of having to rely on an manually made nuspec to handle this situation (perfect for when all of the projects are in a single repository and every commit that is not a tag release gets pushed as a prerelease build and so you just simply cannot change the nuspec every prerelease push as that would generate yet another prerelease push).

**Actual Behavior**:
It all falls apart and just does not work at all.

**User Impact**:
People who have projects that do not target specific api's, and then also have some projects that does target specific apis, and then want to bundle them together as an metapackage to help people save time if they plan to install all of their project's packages anyway.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.