NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):
dotnet.exe
dotnet.exe --version (if appropriate):
3.0.100
OS version (i.e. win10 v1607 (14393.321)):
Microsoft Windows [Version 10.0.18362.418]
Create a solution with two projects called e.g. Test.Lib
and Test.Package
. Use the Microsoft.NET.Sdk
csproj style
In Test.Lib
include:
<PropertyGroup>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Any_Nuget_Package" Version="..." />
</ItemGroup>
<PropertyGroup>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Test.Lib\Test.Lib.csproj" />
</ItemGroup>
dotnet restore
and dotnet build
generating Test.Package.nupkgExpected behaviour: Test.Package.nupkg contains Test.package.nuspec with Any_Nuget_Package
as dependency
Actual behaviour: Test.Package.nupkg contains Test.package.nuspec, but Any_Nuget_Package
is not a dependency.
This results in the consumer of Test.Package.nupkg not knowing about the necessary dependency and resulting in a build with missing dll.
I fully expect it might be an user error, but I'd appreciate support.
It seems that this issue is a duplicate of https://github.com/nuget/home/issues/3891
If that's the case, a possible workaround is documented here: https://github.com/nuget/home/issues/3891#issuecomment-377319939
Let us know if you have any questions.
It seems that this issue is a duplicate of #3891
If that's the case, a possible workaround is documented here: #3891 (comment)
Let us know if you have any questions.
Hi @dominoFire
I have seen it and used it to solve another problem (How to get the Test.Lib.dll into the Test.Package.nupkg).
This is however about including an entry in the generated nuspec's <dependencies>
for the <ProjectReference>
's dependencies.
I can think of a workaround, where I create the <ItemGroup>
with dependencies and include it in both Test.Lib
and Test.Package
, therefore I do not risk de-syncing them, however I'd still rather have an automated solution.
To phrase the issue differently: "How to copy the <ProjectReference>
's <PackageReference>
s into the consuming/parent project."
My problem is exactly what @p-kaczynski describes. As he states, this is not a duplicate. Is there any recommended workaround for this, or plans to address it directly?
Most helpful comment
Hi @dominoFire
I have seen it and used it to solve another problem (How to get the Test.Lib.dll into the Test.Package.nupkg).
This is however about including an entry in the generated nuspec's
<dependencies>
for the<ProjectReference>
's dependencies.I can think of a workaround, where I create the
<ItemGroup>
with dependencies and include it in bothTest.Lib
andTest.Package
, therefore I do not risk de-syncing them, however I'd still rather have an automated solution.To phrase the issue differently: "How to copy the
<ProjectReference>
's<PackageReference>
s into the consuming/parent project."