This project has moved and is read-only. For the latest updates, please go here.

NuGet package content folder/Package install transformations

Dec 15, 2015 at 3:57 PM

I am trying to use XDT transforms in a package, in which on install/uninstall of the package, config values will be installed into the target project's web.config. See here for reference if you're unfamiliar with the process.

I have gotten this to work by manually editing an existing NuGet package by adding a content folder and then the web.config.(un)install.xdt into that folder. However, using your New-NuGetPackage package, I have not been able to figure out how to get the content folder into the package when it auto-creates the package after each build.

I think I am missing something, but I would appreciate any assistance you could provide.

Dec 16, 2015 at 5:37 AM
Edited Dec 16, 2015 at 5:38 AM
Hi, you should be able to simply include a .nuspec file for your project which defines the additional files that you want placed in your Content folder, and the install/uninstall script files.

e.g. If you have MyProject.csproj, then in that same folder (you can add it to the project itself in Visual Studio too if you like) you would also have a MyProject.nuspec file. The .nuspec file would then specify which additional files to include, with a section that looks something like this:
        <file src="web.config.install.xdt" target="content\web.config.install.xdt" />
If you've never seen a .nuspec file before, you can check out the documentation on the NuGet website.

I hope that helps.
Marked as answer by deadlydog on 12/16/2015 at 1:26 PM
Dec 16, 2015 at 9:20 PM
This works, thanks for the info. I had to figure out how to get dynamic values (like version number) from within the .nuspec file instead of hard-coding it, but once I did it's behaving mostly correctly.

Thanks for the info and quick response.