There will be certain specific requirements that the asp.net application gives each developer the privilege to work on their own db. This way the team members can take the project anywhere and without worrying about web.config settings they can override it using an external file

  • File you have is transform.base.web.config. It has the <connectionString> node, but not a valid connection string !
  • Keep your valid/correct sqldb connection string in an xml file with .config extension (ie, transform.xxxx.base.config), with XDT format. My example is as:

<?xml version=”1.0″?>

<configuration xmlns:xdt=”http://schemas.microsoft.com/XML-Document-Transform”>

<connectionStringsxdt:Transform=”Replace”>

<add name=”DefaultConnection” providerName=”System.Data.SqlClient” connectionString=”Data Source=.\Infine_Info;Initial Catalog=Info_ROOT;Integrated Security=SSPI”/>

<add name=”CONNECTION-STRING” providerName=”System.Data.SqlClient” connectionString=”Data Source=.\Infine_Info;Initial Catalog=Info_ROOT;Integrated Security=SSPI”/>

</connectionStrings>

</configuration>

  •  Now we have two transform____.config files which are ready to create the final web.config.
  • We have to run the WebConfigTransform tool which we downloaded in PHASE1 for this.
  • It’s a pre-defined syntax we have to use as: <tool.exe><source.config><corectconnectionstring.config><target.config/web.config>
  • To make life easy, we included this command in the profile as described in Phase 1.
    We can execute it via Nuget console.

    • PM>transform_configs
  • That’s it, now the web.config has been created in the website project
  • Just right click the file and click ‘Include in The Project’
  • Make sure that the web.config and app.config has the correct machinekey settings as below:

<!– Added machineKey for NHibRoleProvider tests –>

<machineKey validationKey=”142BE70791EB988C3CF5C48F2F9BF83F3D57A470B73DBF8AE34229ABAE655347A5C33D53AEC3407726901A2386520DAE0D93E6FB1CFA5928E7BB849C32E87367″

decryptionKey=”AFC0ABB3457FC93262F7FD41574EC668E68772E607283244D49EEF4DC22C0F050DA48106FAF5F948103664A97D90F854465DF4EF5B068C885C3232763E0D4780″

validation=”SHA1″ decryption=”Auto” />

<!– Added machineKey for NHibRoleProvider tests –>

Never ever CHECK-IN the resulted new web.config into TFS.

Leave a Reply