NuGet does not copy configuration file

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

I would like to share with my library an example of a configuration file (or image or something else) that someone can use and get. I tried by default to just do this. I tried to include it in the nuget package through *.nuspec and through *.csproj . None of them worked.

For the *.nuspec part, I 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 also tried this, but only copy the file to other project sources, which I don't want. I would like it to be displayed only at the output of the assembly.

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

In the *.csproj part, I tried to set the build action file to content , resource , embedded resource and None .

Is there any way? Is there any way to tell nuget , take this file and behave like the dll that I provide you with it by its side, wherever you are built?

+6
source share
1 answer

One thought may be to do the configuration conversion of the file . Instead of just deploying the configuration file directly, you can change app.config or web.config in the project with a sample for use by the user. Alternatively, as you mentioned in your comment, you can add a script to Powershell to perform the manipulations that you considered.

+1
source

Source: https://habr.com/ru/post/957563/


All Articles