Config files not being removed when uninstalling the package

Topics: Ecosystem
Mar 21, 2013 at 6:51 PM
I have created a NuGet package with spec file similar as shown below.

The issue that I am experiencing is related to the config files not being removed when the package is uninstalled.

As you can see from the spec file, the .config files have been renamed to .config.transform because some of the config files may exist already in the project, while the others may not exist. The package installation runs flawlessly in all tested scenarios. The problem that I am experiencing has to do with the .config files that do not exist in the project before the package is installed. During the installation the corresponding files in the package are renamed back to .config and added to the project, however these files are not removed when uninstalling the package although their content has not changed.

How can I get the package to delete these remaining config files?


NuGet spec file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
  <metadata>
    <id>WCFServicesProxyPackage</id>
    <version>1.0.3</version>
    <title />
    <authors>Shkelzen a. Saraqini</authors>
    <owners>Shkelzen a. Saraqini</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>WCF services proxy package.</description>
    <language>en-CA</language>
    <references>
      <reference file="WCFServices.Proxy.dll" />
    </references>
  </metadata>
  <files>
    <file src="content\config\system.serviceModel.behaviors.Local.config.transform" target="content\config\system.serviceModel.behaviors.Local.config.transform" />
    <file src="content\config\system.serviceModel.behaviors.Production.config.transform" target="content\config\system.serviceModel.behaviors.Production.config.transform" />
    <file src="content\config\system.serviceModel.behaviors.QA.config.transform" target="content\config\system.serviceModel.behaviors.QA.config.transform" />
    <file src="content\config\system.serviceModel.bindings.Local.config.transform" target="content\config\system.serviceModel.bindings.Local.config.transform" />
    <file src="content\config\system.serviceModel.bindings.Production.config.transform" target="content\config\system.serviceModel.bindings.Production.config.transform" />
    <file src="content\config\system.serviceModel.bindings.QA.config.transform" target="content\config\system.serviceModel.bindings.QA.config.transform" />
    <file src="content\config\system.serviceModel.client.Local.config.transform" target="content\config\system.serviceModel.client.Local.config.transform" />
    <file src="content\config\system.serviceModel.client.Production.config.transform" target="content\config\system.serviceModel.client.Production.config.transform" />
    <file src="content\config\system.serviceModel.client.QA.config.transform" target="content\config\system.serviceModel.client.QA.config.transform" />
    <file src="content\Web.config.transform" target="content\Web.config.transform" />
    <file src="lib\net40\WCFServices.Proxy.dll" target="lib\net40\WCFServices.Proxy.dll" />
  </files>
</package>
Mar 21, 2013 at 8:27 PM
This is a limitation of the current xml transformation engine. You have to delete the file manually.
Mar 22, 2013 at 12:32 PM
Thanks for the prompt reply. Will this issue be addressed in the next release of NuGet?