Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet web.config.transform issue

I'm creating a custom package that needs to modify the web.config file of the destination application, but my config changes never appear in the destination app after installation.

Here's my web.config.transform file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="AppInstalled" value="false"/>
  </appSettings>
</configuration>

This key in the appSettings section is never applied.

Here's my nuspec file:

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <licenseUrl>http://mvcapp.codeplex.com/license</licenseUrl>
    <projectUrl>http://mvcapp.codeplex.com/</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <tags>mvc app</tags>
  </metadata>
  <files>
    <file src="\bin\Release\MvcApp.MVC3.dll" target="lib" />
    <file src="NuGet\Content\ajax-loader.gif" target="Content" />
    <file src="NuGet\Content\web.config.transform" target="web.config" />
    <file src="NuGet\Views\Install\Index.aspx" target="Views\Install\Index.aspx" />
  </files>
</package>

Here's the command I run to package the project from the VS 2010 command prompt:

nuget pack mvcapp.csproj

Any Ideas?

Thanks.

like image 784
Kahanu Avatar asked Apr 23 '11 19:04

Kahanu


1 Answers

The web.config.transform file needs to go into the content folder:

<file src="NuGet\Content\web.config.transform" target="content" />
like image 194
davidfowl Avatar answered Oct 27 '22 19:10

davidfowl