[英]DLL present in Nuget but restore failing
I have the following setup我有以下设置
Proj A Proj B Proj C项目 A 项目 B 项目 C
In Proj D, I added the project reference of Proj A, B and C.在Proj D中,我添加了Proj A、B和C的项目参考。 And I am packaging the Proj D as nuget.
我将 Proj D 包装为 nuget。 I have already followed the solution here https://github.com/nuget/home/issues/3891#issuecomment-377319939
我已经按照这里的解决方案https://github.com/nuget/home/issues/3891#issuecomment-377319939
When I check the nuget package generated, I can see the dlls of Proj A, B and C present in the lib folder.当我检查生成的 nuget package 时,我可以看到 lib 文件夹中存在 Proj A、B 和 C 的 dll。 But when I try to add that nuget to my project, it tries to find the nugets of Proj A, B and C from all my feeds and fails.
但是,当我尝试将 nuget 添加到我的项目中时,它会尝试从我的所有提要中找到 Proj A、B 和 C 的核心并失败。
I am new to this area so not able to figure out what is happening here.我是这个领域的新手,所以无法弄清楚这里发生了什么。 Need some help to understand this scenario.
需要一些帮助来理解这种情况。
I tested this out and it works as expected from the comment you linked.我对此进行了测试,它可以从您链接的评论中按预期工作。
Make sure your project references have the metadata PrivateAssets="all"
.确保您的项目引用具有元数据
PrivateAssets="all"
。 Otherwise, you will get A, B, and C as NuGet package dependencies of package D.否则,您将获得 A、B 和 C 作为 NuGet package ZEFE90A8E6004A7F6B7D8Z 的依赖关系。
The original github comment said to do this.原来的 github 评论说要这样做。 It will not work.
不起作用。
<ItemGroup>
<ProjectReference Include="..\A\A.csproj" Type="project" />
</ItemGroup>
This worked for me (with the custom pack targets).这对我有用(使用自定义包目标)。
<ItemGroup>
<ProjectReference Include="..\A\A.csproj" PrivateAssets="all" />
</ItemGroup>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.