Search code examples
c#webdeploy

Building a webdeploy project not using values in iis deployment


Clearly I'm not understanding the wiring of the appdeploy.pubxml file.

I want to have a connection string like this in my web.config file:

<add name="TestDB" connectionString="Server=.\SQLExpress;User ID=WebUser;Password=[pass];Initial Catalog=TestDB" providerName="System.Data.EntityClient" />

In my appdeploy.pubxml file I have this:

<PublishDatabaseSettings>
  <Objects xmlns="">
    <ObjectGroup Name="TestDB" Order="1" Enabled="False">
      <Destination Path="Data Source=.\SQLExpress;Initial Catalog=TestDB;User ID=WebUser;Password=[Pass];Application Name=EntityFramework" Name="Data Source=.\SQLExpress;Initial Catalog=TestDB;User ID=WebUser;Password=[pass];MultipleActiveResultSets=True;Application Name=EntityFramework" />
    </ObjectGroup>
  </Objects>
</PublishDatabaseSettings>

<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)TestDB-Web.config Connection String">
  <ParameterValue>Data Source=.\SQLExpress;Initial Catalog=TestDB;User ID=WebUser;Password=[Pass];Application Name=EntityFramework</ParameterValue>
</MSDeployParameterValue>
</ItemGroup>

When I publish the app, copy it over to a test iis server and import it, I get the dialog to enter the information and the is in the textbox. However, the connection string in the web.config on the web server is re-written with:

    <add name="TestDB" connectionString="Server=[YourDbServerAddress];User ID=[YourDbLogin];Password=[YourDbPassword];Initial Catalog=[YourDbName]" providerName="System.Data.EntityClient" />

So it's like the information item is not matching the config I have in appdeploy.pubxml so it doesn't get passed on. What am I doing wrong?

Can I use what is there already or if it doesn't exist use the "Default"?


Solution

  • The answer is in the web.release.config transform file. This is what configures the lines in the web.config file. The appdeploy seems to control the menu option when installing the site.