This project has moved. For the latest updates, please go here.
1

Closed

Don't update xml config if I pass connection info on command line

description

I don't want to store the the connection info in source control so I keep it in a seperate file but when I run sqlinstaller it updates the xml file anyway.

I'm assuming that you are per-machine encryption keys (but I could be wrong) which means that other devs won't be able to decrypt it. Though I haven't tested this.
Closed Mar 8, 2013 at 2:49 PM by bschloz
Setting attribute IsProtected='true' will prevent encryption and update to the xml config file.

comments

bschloz wrote Mar 6, 2013 at 3:05 PM

Yes, the encryption keys are per-machine. Your strategy of using a separate xml file is a good one. Simply make a copy of the SQLInstaller.xml file (e.g. MySQLInstaller.xml). You then just need to make sure and then pass this as a parameter:

SQLInstaller.exe MySQLInstaller.xml

Now, you can keep your own developer specific XML file separate from the primary SQLInstaller.xml (which can be used by an automated build server for example). If you want to re-encrypt the connection string by passing it as a parameter it should update the appropriate file (MySQLInstaller.xml in this example) as long as you continue to pass it as the first parameter. You also have the option of storing the connection string unencrypted in your own version fo the xml file. In that case, you would toggle the IsProtected flag to true and then leave it unencrypted in the xml file. In either case, it is not necessary to pass it on the command-line - simply edit your own personalized XML file prior to running the utility.

ormico wrote Mar 6, 2013 at 8:37 PM

I think I see a solution. If I set IsProtected="true" it won't add the encrypted connection string data to the xml file?

I keep the connection properties in a dev specific file that is not source controled in the root of the project tree named project.properties

this file is based on msbuild xml and looks something like this

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
    <ConnectionString>Data Source=.\SQL2008R2;Integrated Security=SSPI</ConnectionString>
    <DataBase>test1</DataBase>
</PropertyGroup>
</Project>

each dev and each build server get their own copy which is not source controled, pointing to the db we want to run against.

This lets me keep all the dev/build server specific project properties in one easy to parse file. MSbuild reads the file natifly and powershell can parse xml easily.

I then have different build scripts written in either msbuild or powershell that all reference this file when they run.

So currently I have 1 xml for each database that I build with sqlinstaller.exe. sqlinstaller reads the xml file and I pass in the database and connection string on the command line which is read from project.properties.

If I had to have a different sqlinstaller.xml for each db and each dev then I also have to duplicate my FileTypes rules and keep those in sync for each dev.

But it looks like settint the IsProtected="true" does what I want. Am I correct?

bschloz wrote Mar 7, 2013 at 3:03 PM

Correct. If you set IsProtected='true' you can keep the connecting string unencrypted in the XML file or pass in through the command-line as you have been doing. In this case, there would be no attempt to encrypt the connection string and overwrite the xml file.

wrote Mar 8, 2013 at 2:49 PM

wrote May 16, 2013 at 8:05 AM