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

Is it possible to use GeneratePathProperty from nuget package installed in a dependant project?

$
0
0

I've a c# solution with 2 projects in .net framework 4.8: ProjectA and ProjectB.

ProjectA has installed a nuget package, called NugetPackageInternal package that exports a contentFile: NugetPackageInternalFile.

ProjectB depends on ProjectA and needs to use the NugetPackageInternalFile

To use NugetPackageInternalFile in ProjectB I've added this into ProjectB.csproj:

<ItemGroup><Content Include="$(NuGetPackageRoot)\NugetPackageInternal\0.0.1\contentFiles\any\any\NugetPackageInternalFile"><Link>TestData\NugetPackageInternalFile</Link><CopyToOutputDirectory>Always</CopyToOutputDirectory></Content></ItemGroup>

This works but, whenever there is new version of NugetPackageInternal I need to manually change ProjectB.csproj to update the 0.0.X version.

To fix this the only way I found is to install the NugetPackageInternal also into ProjectB and add the GeneratePathProperty=true, so my ProjectB.csproj looks like this:

<ItemGroup><PackageReference Include="NugetPackageInternal" GeneratePathProperty="true"><Version>0.0.2</Version></PackageReference></ItemGroup><ItemGroup><Content Include="$(PkgNugetPackageInternal)\contentFiles\any\any\NugetPackageInternalFile"><Link>TestData\NugetPackageInternalFile</Link><CopyToOutputDirectory>Always</CopyToOutputDirectory></Content></ItemGroup>

This works fine also, but my question would be: Is there a way to refer NugetPackageInternalFile from ProjectA and avoid to install the NugetPackageInternal into ProjectB?

Adding GeneratePathProperty=true into ProjectA PackageReference doesn't work.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



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