Microsoft.AspNetCore.App - Versioning / Should it be referenced in non ASP.NET class libraries?
I think you might want to observe the NuGet Version ranges and wildcards notation.
When referring to package dependencies, NuGet supports using interval notation for specifying version ranges, summarized as follows:
+-----------+---------------+-------------------------------------------------------+
| Notation | Applied rule | Description |
+-----------+---------------+-------------------------------------------------------+
| 1.0 | x ≥ 1.0 | Minimum version, inclusive |
| (1.0,) | x > 1.0 | Minimum version, exclusive |
| [1.0] | x == 1.0 | Exact version match |
| (,1.0] | x ≤ 1.0 | Maximum version, inclusive |
| (,1.0) | x < 1.0 | Maximum version, exclusive |
| [1.0,2.0] | 1.0 ≤ x ≤ 2.0 | Exact range, inclusive |
| (1.0,2.0) | 1.0 < x < 2.0 | Exact range, exclusive |
| [1.0,2.0) | 1.0 ≤ x < 2.0 | Mixed inclusive minimum and exclusive maximum version |
| (1.0) | invalid | invalid |
+-----------+---------------+-------------------------------------------------------+
So instead of removing the Version property altogether use a range or wildcard, eg:
Minimum version, inclusive
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1" />
Ref: How to correct dotnet restore warning NU1604, does not contain an inclusive lower bound?
It takes some configuring and I hope Microsoft sort all this out in RTM 3.0 with a wizard to update the dependency tree... Here's a project from 6 months ago it contains a reference to Microsoft.AspNetCORE.Mvc
:
Here's a project I'm working on and I had to explicitly reference certain packages (to get ActionResults I had to add 2 specific references.):
Using the NuGet notation allows finely grained libraries when you need it, or future-proof modularity with range/wildcard API updates or you can reference the full kit and caboodle.