[英]Several project nuget package. Unable to find package
I have to netstandard2.0 projects:我要netstandard2.0项目:
project A client reference project b lib like:项目 A 客户参考项目 b lib,如:
...
<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->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
</ItemGroup>
</Target>
...
I try to create nuget package: dotnet pack projectA/src/client.csproj --configuration Client
我尝试创建 nuget package:
dotnet pack projectA/src/client.csproj --configuration Client
.nupkg contains lib.dll, but... .nupkg 包含 lib.dll,但是...
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
当我尝试将 package 引用到 projectC 时,我得到
projectC.csproj: [NU1101] Unable to find package projectB. No packages exist with this id in source(s): nuget.org
projectC.csproj: [NU1101] Unable to find package projectB. No packages exist with this id in source(s): nuget.org
How to fix it?如何解决?
I found that in addition to the custom target you link to I also needed to add PrivateAssets="all"
to the ProjectReference.我发现除了链接到的自定义目标之外,我还需要将
PrivateAssets="all"
添加到 ProjectReference。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.