Skip to content
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

System packages when installing on .NET Core 3.0 #140

Closed
Daniel15 opened this issue Oct 22, 2019 · 12 comments
Closed

System packages when installing on .NET Core 3.0 #140

Daniel15 opened this issue Oct 22, 2019 · 12 comments

Comments

@Daniel15
Copy link

Daniel15 commented Oct 22, 2019

When I install this in a .NET Core 3.0 app, it seems to pull a whole heap of packages from NuGet:

Installing Reinforced.Typings 1.5.5.
Installing NuGet package Reinforced.Typings 1.5.5.
Committing restore...
Generating MSBuild file C:\src\...\src\Example.Web\obj\Example.Web.csproj.nuget.g.props.
Generating MSBuild file C:\src\...\src\Example.Web\obj\Example.Web.csproj.nuget.g.targets.
Writing assets file to disk. Path: C:\src\...\src\Example.Web\obj\project.assets.json
Successfully installed 'Microsoft.NETCore.App 2.0.0' to Example.Web
Successfully installed 'Microsoft.NETCore.DotNetAppHost 2.0.0' to Example.Web
Successfully installed 'Microsoft.NETCore.DotNetHostPolicy 2.0.0' to Example.Web
Successfully installed 'Microsoft.NETCore.DotNetHostResolver 2.0.0' to Example.Web
Successfully installed 'Microsoft.NETCore.Platforms 2.0.0' to Example.Web
Successfully installed 'Microsoft.NETCore.Targets 1.1.0' to Example.Web
Successfully installed 'NETStandard.Library 2.0.0' to Example.Web
Successfully installed 'Reinforced.Typings 1.5.5' to Example.Web
Successfully installed 'System.Collections 4.3.0' to Example.Web
Successfully installed 'System.Diagnostics.Debug 4.3.0' to Example.Web
Successfully installed 'System.Globalization 4.3.0' to Example.Web
Successfully installed 'System.IO 4.3.0' to Example.Web
Successfully installed 'System.IO.FileSystem 4.3.0' to Example.Web
Successfully installed 'System.IO.FileSystem.Primitives 4.3.0' to Example.Web
Successfully installed 'System.Linq 4.3.0' to Example.Web
Successfully installed 'System.Reflection 4.3.0' to Example.Web
Successfully installed 'System.Reflection.Emit 4.3.0' to Example.Web
Successfully installed 'System.Reflection.Emit.ILGeneration 4.3.0' to Example.Web
Successfully installed 'System.Reflection.Extensions 4.3.0' to Example.Web
Successfully installed 'System.Reflection.Primitives 4.3.0' to Example.Web
Successfully installed 'System.Reflection.TypeExtensions 4.3.0' to Example.Web
Successfully installed 'System.Resources.ResourceManager 4.3.0' to Example.Web
Successfully installed 'System.Runtime 4.3.0' to Example.Web
Successfully installed 'System.Runtime.Extensions 4.3.0' to Example.Web
Successfully installed 'System.Runtime.Handles 4.3.0' to Example.Web
Successfully installed 'System.Runtime.InteropServices 4.3.0' to Example.Web
Successfully installed 'System.Runtime.Loader 4.3.0' to Example.Web
Successfully installed 'System.Text.Encoding 4.3.0' to Example.Web
Successfully installed 'System.Text.Encoding.Extensions 4.3.0' to Example.Web
Successfully installed 'System.Text.RegularExpressions 4.3.0' to Example.Web
Successfully installed 'System.Threading 4.3.0' to Example.Web
Successfully installed 'System.Threading.Tasks 4.3.0' to Example.Web
Successfully installed 'System.Threading.Tasks.Extensions 4.3.0' to Example.Web
Successfully installed 'System.Xml.ReaderWriter 4.3.0' to Example.Web
Successfully installed 'System.Xml.XmlDocument 4.3.0' to Example.Web
Successfully installed 'System.Xml.XmlSerializer 4.3.0' to Example.Web

Is this expected?

@pavel-b-novikov
Copy link
Member

Well.. It seems that everything listed above is more or less needed within RT, yes :)

@Daniel15
Copy link
Author

@pavel-b-novikov - Shouldn't it just be using the system packages though? I don't understand why it had to install them from NuGet.

This part in particular looks suspicious:

Microsoft.NETCore.App 2.0.0

Why is it referencing Microsoft.NETCore.App 2.0 in my 3.0 app?

@pavel-b-novikov
Copy link
Member

RT is multi-targeting, so it has versions for netcoreapp2.0, full-sized .NET and other verions. I'm not sure, but suspect that it is somehow related. Anyway it seems that I do not list anything critical with nuspec. I'm trying to keep RT as small as possible, but maybe you can help to find out what problem is there?

@Daniel15
Copy link
Author

I'll try to take a look soon!

@Daniel15
Copy link
Author

Strangely, even after removing all the dependencies from the nuspec, it's still trying to install all those dependencies:

Tried adding .NET Standard 2.1 as a framework, and double-checked in NuGet Package Explorer that my modified package has no dependencies:

However, I do see a file at lib/netcoreapp3.0/Reinforced.Typings.deps.json that contains the framework references. I wonder if that's the cause.

@Daniel15
Copy link
Author

Filed in NuGet repo too: NuGet/Home#8734

@pavel-b-novikov
Copy link
Member

Thanks a lot! I have too much activity to take a look on this

@viktor-svub
Copy link
Contributor

Hi! I see this in my NETCoreApp 3.0 project too, even when using Paket instead of NuGet,
and I believe the root cause is the fallback path used by package resolvers prefers the same platform first, and only switches to different if it runs out of options.

For the published version 1.5.5, it results in the netcoreapp2.0 dependencies being required for netcoreapp3.0 project, instead of any netstandard version, as any netcoreapp is "closer" than any netstandard, regardless of version.

In this case, the fix should be adding a netcoreapp3.0 section in the NuGet/NuSpec, with the same dependencies as netstandard2.0, to prevent the fallback to older netcoreapp.

@pavel-b-novikov
Copy link
Member

I will try, thanks

@viktor-svub
Copy link
Contributor

@pavel-b-novikov after digging a bit deeper, it even seems like both of the netstandard2.0 dependencies are part of the now implicit and hidden Microsoft.NETCore.App/3.0.0, so the netcoreapp3.0 dependencies section should be present and empty, I'd believe.

@Daniel15
Copy link
Author

I got this reply from the NuGet team:

... the problem is that Microsoft.NETCore.App should never have been referenced in that nuspec, and instead used something like Microsoft.NETStandard.Library, because platform packages are handled differently by nuget (and dotnet). That said, these assemblies may still be needed at compile time even though they're part of the runtime, and the special handling to hide these even further was added in netcore3. I... think that captures it. I don't fully grok this yet, but it sounds like removing the particular dependency from the nuspec should help.

Beyond that, you might be running into name conflict issues with your no-dependency test, because of how nuget handles its global packages folder.

I guess my testing wasn't actually effective as it was using a cached version of the package.

@viktor-svub Have you attempted to fix it?

viktor-svub added a commit to viktor-svub/Reinforced.Typings that referenced this issue Dec 21, 2019
… to the nuspec, avoiding unexpected fallback paths
@viktor-svub
Copy link
Contributor

ok, after a slightly longer delay than expected, I got to build the nuget locally and verified the assumed fix, here is the PR #155 :)

pavel-b-novikov added a commit that referenced this issue Dec 24, 2019
fixes issue #140 by adding netcoreapp3.0 and 3.1 explicitly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants