1

I have to netstandard2.0 projects:

  1. projectA/src/client/client.csproj
  2. projectB/src/lib/lib.csproj

project A client reference project b lib like:


...

<ItemGroup>
    <ProjectReference Include="..\..\..\projectB\src\lib.csproj">
        <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
        <IncludeAssets>lib.dll</IncludeAssets>
    </ProjectReference>
</ItemGroup>

<Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage">
    <ItemGroup>
        <BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
    </ItemGroup>
</Target>

...


I try to create nuget package: dotnet pack projectA/src/client.csproj --configuration Client

.nupkg contains lib.dll, but...

When I try to reference package to projectC I get projectC.csproj: [NU1101] Unable to find package projectB. No packages exist with this id in source(s): nuget.org

How to fix it?

VoidName
  • 340
  • 2
  • 16
  • find with issue, but don't find answer https://github.com/NuGet/Home/issues/3891 – VoidName Jul 10 '20 at 10:46
  • 1
    solution: https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#advanced-extension-points-to-create-customized-package – VoidName Jul 10 '20 at 12:17

1 Answers1

0

I found that in addition to the custom target you link to I also needed to add PrivateAssets="all" to the ProjectReference.

Trygve
  • 591
  • 1
  • 7
  • 22