CPVM seems not to take FrameworkReferences into account
See original GitHub issue@MichaeIDietrich commented on Sun, 29 Nov 2020 11:24:59 GMT
Description
Projects that use central package version management can produce different DLLs in the output if there is a project that uses PackageReference
for a specific dependency while another uses FrameworkReference
indirectly for the same dependency.
Steps to reproduce
- Clone this repository: https://github.com/MichaeIDietrich/TestCpvmWithFrameworkReferences
- One project references
Microsoft.Extensions.DependencyInjection.Abstractions
directly using the related NuGet package while the other project references this assembly indirectly by using ASP.NET Core FrameworkReference
- One project references
- Open cmd.exe in the repo root folder
- Run
dotnet publish
Actual behavior
If you check the publish folder (%Project name%\bin\Debug\netcoreapp3.1\win-x64\publish) of both projects and inspect the details of Microsoft.Extensions.DependencyInjection.Abstractions.dll
, you will see that the DLLs are different:
For project LibraryUsingServiceProvider
InternalName: Microsoft.Extensions.DependencyInjection.Abstractions.dll
OriginalFilename: Microsoft.Extensions.DependencyInjection.Abstractions.dll
FileVersion: 3.100.920.47302
FileDescription: Microsoft.Extensions.DependencyInjection.Abstractions
Product: Microsoft .NET Extensions
ProductVersion: 3.1.9+d8a50ea1cc9892cda13c5237dec402ca10ddeaa1
Size: 36.8 KB
For project WebProject
InternalName: Microsoft.Extensions.DependencyInjection.Abstractions.dll
OriginalFilename: Microsoft.Extensions.DependencyInjection.Abstractions.dll
FileVersion: 3.100.920.47302
FileDescription: Microsoft.Extensions.DependencyInjection.Abstractions
Product: Microsoft .NET Extensions
ProductVersion: 3.1.9+d8a50ea1cc9892cda13c5237dec402ca10ddeaa1
Size: 70.8 KB
Both have different sizes!
Expected behavior
Resulting DLLs for projects that use central NuGet package version management are identical.
Version info
dotnet SDK version: 5.0.100
Windows version: 20H2 (Build 19042.630)
Details about the problem
The reason for this might be that the NuGet package uses a .NET Standard 2.0 variant while the ASP.NET Core Framework has a .NET Core 3.1 variant of this DLL.
Is there a way to resolve this mismatch? Currently we have problems with publishing, since we expect all projects to have identical DLLs when building the installer, since all files will end up in the same installation folder. We have found no real way to determine which DLL we should pick, since both have identical version information.
At the moment we work around this issue by adding the ASP.NET Core FrameworkReference as dependency to all top level projects, but I hope there is a better way to resolve this.
Can you please help us with this issue?
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (8 by maintainers)
Top GitHub Comments
I am taking a look @MichaeIDietrich On first glance it appears that the size difference is because the one DLL is cross gen’d. Framework references follow a different path AFAIK. I hope to have more detailed answers for you soon.
Let me take a closer look and get back to you. I suspect though that if you flip the package references that it would select the netstandard copy. Likely because they’re of equal version and it simply selects the first one.