Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

How to override nuget dependencies id in nuspec file

$
0
0

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 ?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>