Transitive dependency not copied to dependent project's output file
Closed this issue · 2 comments
Details about Problem
Nuget is used in conjunction with VisualStudio / MSBuild. Versions are VS16.7.4 / Nuget 5.7.0
The general problem occurs with a very special package, namely System.ComponentModel.Annotations. The NetStandard implementation includes code from the System.ComponentModel.DataAnnotations namespace to extend functionality missing in NetStandard, while the NetFramework version just forwards assembly references to the appropriate framework assemblies. What I found is that when pulling the System.ComponentModel.Annotations Nuget package indirectly into a framwork assembly, its assembly file is not properly passed to dependent projects. Not sure if this is a Nuget or MSBuild-issue, probably an interaction here.
Detailed repro steps so we can see the same problem
Based on the assemblies in question:
- Create a project/assembly S that is netstandard2.0 and has a reference to the Nuget package System.ComponentModel.Annotations. Build a Nuget package out of it.
- Create a project/assembly F that is .Net-Framwork (4.7.2 here, but that may be a minor issue), references the Nuget package of S and also has an assembly reference in the resulting build output.
- Create a project/assembly X that is also .Net-Framework and has an assembly/project reference on F.
What I find in this constellation is that
- the output folder of F contains the .Net-Framework assembly of System.ComponentModel.Annotations
- The output folder of X lacks this assembly, leading to runtime errors
...
Other suggested things
Verbose Logs
Please include verbose logs (NuGet.exe -verbosity detailed | dotnet.exe --verbosity diag | etc...)
Sample Project
Very helpful if you can zip a project and paste into this issue!
Hey @ulfllorenz
I tried following your steps and I was not able to repro this.
The output of X contains 4 dlls, F.dll, S.dll, X.dll and System.Component.Model.Annotations.dll.
Can you please take a look at my repro https://github.com/nkolev92/NuGetHome10086 and check if it mirrors your set-up?
Thanks!
Originally, I wanted to answer by trying to recreate the specific problem that I encountered some weeks ago when we started with Nuget, but looking at the solution again, I would rather say it was a big mess with assembly references, package references + package references that referenced transitive dependencies, but in the wrong version. I could not faithfully consider this an issue on the side of MSBuild/Nuget any longer.
When I come across an issue again I will open a more relevant ticket, but for this specific incarnation, it seems better to close it directly. Thanks for the response, in any case.