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

How to Get Content Files from a Dependency of a Dependency with Nuget

$
0
0

Let's say I have 2 packages: Car.nupkg and Wheel.nupkg. The Car project includes a reference to the Wheel project, but only the Car package is installed in the AutoFactory project.

The Wheel.nupkg includes a connections.json file for that defines where to get the rims from for example and theCar.nupkg includes a color.config file that defines the color of the car.

Both of these files have placeholders in them and they will be replaced with other values before deployment as you get the rims from different places for each environment and the car color also changes per environment to make it easier for us to recognize where the car comes from.

So when deployed, AutoFactory needs both the files present in its output directory to perform its job correctly.

Currently, Wheel.csproj has this:

<ItemGroup><Content Include="connections.json" Pack="true"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory><PackageCopyToOutput>true</PackageCopyToOutput></Content></ItemGroup>

and Car.csproj has this:

<ItemGroup><Content Include="color.config" Pack="true"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory><PackageCopyToOutput>true</PackageCopyToOutput></Content></ItemGroup>

With the way it is now, when I install the Car package in AutoFactory, content and contentfiles folders only include the color.config file.

How do I need to change the Wheel.csproj (or Car.csproj) so that its contents will also end up in the output folder.

This is mostly important because there are many "Factories" out there that don't have a direct reference to the Wheel package and we are just introducing this connections.json file because let's say, we stopped producing our own rims and decided to get it from somewhere else. So ideally, I'd prefer not to go to all the different Factories and install the Wheel package directly, especially because maybe in the future cars won't have wheels (!?) or the AutoFactory will not always make stuff with wheels and a direct reference suggests that the factory needs the wheel package directly.

Sorry if my example doesn't make sense but this was the best I could come up with.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



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