Encrypting config files as part of a VS build event

  • Thread starter Thread starter DingoBoy
  • Start date Start date
D

DingoBoy

Is it possible to create a post build event to encrypt my config file (which
holds my connection strings)? The reason I would like to do this is that
while we are developing I would like the developers to be able to see/modify
the connection strings appropriately, but when we do a release build and
deploy the application and config file to a target machine I want the config
files (or at least the connection strings with the file) to be encrypted. I
realize this can be achieved within the code, and then place the resulting
encrypted config file under source control, but any changes to one or more
connection strings would be a burden (ie. recontructing the original file,
making the changes, then re-encrypting)
Cheers
Justin
 
After posting this I realized a probable flaw in my approach. As this
application (and its associated config file) will be deployed on a different
machine the encryption key will not be known on that machine (as it was
encrypted on a developer's machine). Does it make more sense to deploy the
unencrypted config file and then encrypt it once it is deployed?

Cheers

Justin
 
Back
Top