dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.65k stars 1.06k forks source link

C++/CLI Net Core 3.1 dll includes reference to every dll included in framework #15535

Open amaitland opened 3 years ago

amaitland commented 3 years ago

Hi,

It wasn't clear on the best place to raise this so if I'm in the incorrect place can someone point me to the appropriate repository.

Summary

When compiling a C++/CLI project using Net Core 3.1 and inspecting it's references in say dotPeek, every single dll that's part of the Microsoft.NETCore.App 3.1 framework (%ProgramFiles%\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1) is listed as a reference.

C++/CLI Builds targeting .Net 4.x only includes the required references. .Net Core 3.1 managed dlls only include the required references.

Steps to reproduce

Additional

This is rather undesirable as .Net 5.0 has removed support for some of these dlls (e.g. System.Runtime.InteropServices.WindowsRuntime) which I'm not using and yet show up in the references (everything shows up).

For reference my project is https://github.com/cefsharp/CefSharp Using the GitHub repository referenced in https://devblogs.microsoft.com/cppblog/porting-a-c-cli-project-to-net-core/ to confirm the issue isn't CefSharp specific and can easily be reproduced.

The CefSharp.Core.Runtime.dll contained within https://www.nuget.org/packages/CefSharp.Common.NETCore/87.1.131-pre can be extracted for analysis if required (there are x86/x64 variants in the runtimes folder)

Thanks, Alex


clicppnetcorerferences

System: Visual Studio: 16.8.3

dotnet --info .NET SDK (reflecting any global.json): Version: 5.0.101 Commit: d05174dc5a

Runtime Environment: OS Name: Windows OS Version: 10.0.19041 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.101\

Host (useful for support): Version: 5.0.1 Commit: b02e13abab

.NET SDKs installed: 5.0.100 [C:\Program Files\dotnet\sdk] 5.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

sfoslund commented 3 years ago

@wli3 is this expected for C++?

wli3 commented 3 years ago

@sfoslund this is this case today. I need to look into this more. @olgaark FYI