Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet doesn't copy config file

I've tried many different things now, none of which seem to work out as expected.

I would like to share an example config(or image or whatever) file with my library that someone would be able to use and derive from. I tried to default to just To do so I tried to include it in the nuget package via *.nuspec and via *.csproj. None of which worked.

For the *.nuspec part, I've tried this:

<file src="bin\$configuration$\example.mylib.config" target="lib\net45" />
<file src="bin\$configuration$\example.mylib.config" target="build" />
<file src="bin\$configuration$\example.mylib.config" target="bin" />

I've also tried this, but that only copies the file to the other projects sources, which is not what I want. I would like it to only show up in the output of the build.

<file src="bin\$configuration$\example.mylib.config" target="content" />

For the *.csproj part, I've tried to set the build action of the file to content, resource, embedded resource and None.

Is there a way at all? Is there a way to tell nuget, take this file, and behave like the dll I'm providing needs this by it's side, wherever you build?

like image 571
Kjellski Avatar asked Nov 07 '13 07:11

Kjellski


1 Answers

One thought might be to perform a config file transformation. Rather than just deploying a config file directly, you could modify the app.config or web.config on the project with a sample for the user to apply. Alternatively, as you mentioned in your comment, you could add in a Powershell script to perform the manipulations you were considering.

like image 66
techvice Avatar answered Oct 02 '22 14:10

techvice