How to override nuget dependencies id in nuspec file

被刻印的时光 ゝ 提交于 2020-07-10 10:27:26

问题


I have projectA and projectB in the same solution.

projectA creates its own package, but I override the package id by using a prefix:

 <PackageIdPrefix></PackageIdPrefix>
 <PackageId>$(PackageIdPrefix)$(MSBuildProjectName)</PackageId>

The command to generate the package is :

dotnet pack  .\$(ProjectName).csproj  --include-symbols --no-build -o C:\dev\UPP\Packages -p:PackageIdPrefix=MyPrefix."

Therefore the generated package name is MyPrefix.ProjectA.nupkg

projectB references projectA as a project reference since they belong to the same solution. projectB creates its own package, in the same way:

   <PackageIdPrefix></PackageIdPrefix>
   <PackageId>$(PackageIdPrefix)$(MSBuildProjectName)</PackageId>

However in the nuspec of the generated MyPrefix.ProjectB.nupkg I end with :

  <dependency id="ProjectA" version="1.0.0" exclude="Build,Analyzers" />

So the prefix was not used to create the dependency in the nuspec. Obviously this leads to an error when I try to install this package since the dependency ProjectA does not exist...

How can I prefix the dependency ?

来源:https://stackoverflow.com/questions/62803055/how-to-override-nuget-dependencies-id-in-nuspec-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!