Reputation: 6547
I have some information in my nupkg that I would like to include in the consumer's application. What is the best way to include a partial app.config directly when consuming the nupkg?
I have currently done this:
But this makes that it wants to override a user's own App.config, while there could be valuable information in there.
So I want to combine my App.config with the user's App.config.
I already saw something like this: C#: manage Multiple App.config files, but I cannot see how I could force the user to include my piece into its App.config.
Contents of my App.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="somefolder;someotherfolder;" />
</assemblyBinding>
</runtime>
</configuration>
How can I force the consumer to add my App.config to its own app.config?
Upvotes: 2
Views: 5053
Reputation: 73243
You do this using .transform files:
In NuGet's traditional way of configuration-file transformation, you add a file to your package's content and give it the same name as the file you want to transform, followed by a .transform extension. For example, to transform a web.config file, you create a web.config.transform file. The transformation file contains XML that looks like a web.config or app.config file, but it includes only the sections that need to be merged into the project's configuration file.
Upvotes: 5