Is there a way to configure a nuGet package so that a file is installed, inside a project, only if it does not already exist in the project?
Specifically, my nuGet package contains a custom config file. Once installed, the user will make modifications to the file. The problem is that the config file gets replaced when the user installs a new version of my nuGet package -- thus, losing their changes. I want to prevent this.
Let's assume that you are using Visual Studio and need to deploy log4net.config if it is missing.
Add to the nuspec file:
It will include the files in the tools folder into the package
place inside the tools folder the file install.ps1 with some code similar to:
Create the package using (for example):
If you want to look inside the generated package, rename it to *.zip. Then you can view what's inside using any archive manager.