-
Notifications
You must be signed in to change notification settings - Fork 748
Trying to install NUnit 3.6.1 on .NET Framework asks for download of 20 more packages #2165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like when you target 4.7 that NuGet decides to reference the .NET Standard version of NUnit rather than the .NET 4.5 version. Technically both are correct, but I would think the .NET 4.5 would be more correct. A fix would be to put a copy of the .NET 4.5 assembly in a When we fix this, we should also check .NET 4.6.2 and even 4.6.1 when included from the new CSPROJ format. Speaking of, @Jivko1212, is your .NET 4.7 project using the new CSPROJ format? |
On a slightly related note, see nunit/dotnet-test-nunit#118 |
@rprouse I'm suffering from the same issue and yes, it's CSPROJ format. |
@Caleb9 is it the new style |
@rprouse I don't think so. I'm developing in VS 2017 but the project was created still in 2015 and it does contain some
so I'm guessing it's the old style? |
Yup, that's old style, thanks. I will perform some tests and create a fix. I will likely wait until the .NET Standard pull request is merged otherwise there will be conflicts in the NuGet file and I also want to see how .NET Standard 1.3 behaves. |
I created test projects targeting the above framework and referenced NUnit. Looking in the project files, they all correctly target the .NET 4.5 version of the framework, but .NET 4.6 and above project pull in all the extra dependencies. I then tried to install another similar NuGet package and it did not display the same behaviour. The only difference I see is that theirs explicitly states no-dependencies for the .NET 4.5 and other frameworks, where we don't say anything. I am testing that hypothesis... |
Adding empty dependencies groups does fix the issue. I am working on the .NET Standard branch because the Nuspec files is changed too much to not conflict, so I will include the fix for this in that PR. The dependencies in the nuspec now look like this, <dependencies>
<group targetFramework="net20" />
<group targetFramework="net35" />
<group targetFramework="net40" />
<group targetFramework="net45" />
<group targetFramework="netstandard1.3">
<dependency id="NETStandard.Library" version="1.6.0" />
<dependency id="System.Threading.Thread" version="4.3.0" />
</group>
<group targetFramework="netstandard1.6">
<dependency id="NETStandard.Library" version="1.6.0" />
<dependency id="System.Runtime.Loader" version="4.3.0" />
<dependency id="System.Threading.Thread" version="4.3.0" />
</group>
</dependencies> |
Just wanted to add that I am able to install NUnit on 4.6.1 without pulling extra dependencies. I had a similar issue with NSubstitute and though that this is due to the following table: https://docs.microsoft.com/en-us/dotnet/articles/standard/library it says here that 4.6.1 supports .NET Standard up to 2.0, while 4.6.2 doesn't. |
@Jivko1212 Oh boy, they keep having to clarify that chart. net462 is a superset of net461. Because net461 supports netstandard20, net462 supports netstandard20 as well. That chart is listing the minimum version supporting, not the maximum version. The change from ".NET Framework (with tooling 1.0)" to ".NET Framework (with tooling 2.0)" actually made .NET Framework more compatible earlier. |
@Jivko1212 Another way to look at it:
|
Hi thanks for the much better chart .. it is strange though that both NUnit and NSubstitute work perfectly on 4.6.1 but ask to download ton of packages on 4.6.2 .. no idea why .. this is the reason I am developing on 4.6.1 as opposed to 4.6.2 and 4.7 now |
It looks like @rprouse figured out what was causing it. Looks like NuGet uses the best matching target framework dependency group. Without the empty groups, net452 and earlier cannot match any dependency group and have no extra packages, but net46 - net47 match the Now with the empty groups, net46 - net47 match the all the groups |
@Jivko1212 I saw 4.6.2 causing problems because I was using an updated version of NUnit that includes dependencies for .NET Standard 1.3. The released version only has dependencies for .NET Standard 1.6. |
Oh, I left out the fact that with the new .NET Core tooling net461 - net47 also match the |
I can install NUnit on .Net Framework 4.6.1 without a problem but when I try to install it via Nuget on the newly released 4.7 it asks for these packages:

And this is only half of the list
The text was updated successfully, but these errors were encountered: