I have a requirement where I need to install configuration files into the target project via NuGet. These files are meant to be edited by the end user and should therefore NEVER be updated.
I tried splitting the configuration files into their own NuGet package and using NuGet's versioning constraints to solve this, but it doesn't work. There is no way to constrain it so upgraders never get a new version AND new installers get the latest version. For example:
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Other Stuff Omitted -->
<dependencies>
<group targetFramework="net35">
<dependency id="MyPackage.MVC4.Core" version="[$version$]" />
<dependency id="MyPackage.Web" version="[4,5)" />
</group>
<group targetFramework="net40">
<dependency id="MyPackage.MVC4.Core" version="[$version$]" />
<dependency id="MyPackage.Web" version="[4,5)" />
</group>
<group targetFramework="net45">
<dependency id="MyPackage.MVC4.Core" version="[$version$]" />
<dependency id="MyPackage.Web" version="[4,5)" />
</group>
</dependencies>
</metadata>
</package>
This keeps the upgraded version of MyProject.Web at the current version, but when installed in a new project the version of MyPackage.Web never exceeds 4.0.x even when the latest version is higher.
If I try the other end of the spectrum and use $version$, which gets replaced with the current version, then people with older versions of NuGet end up having their configuration files reset when they upgrade because they are forced to update their package.
So I would like to try a different approach. I am thinking that putting the files into a "first" directory and then copying them recursively only if they don't already exist is the target project. However, I ran into another snag - there doesn't appear to be any documentation for the $package object that is passed into the install.ps1 script.
Are there any other options of how to meet this requirement that I am unaware of?