问题
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