Getting some files from source control

Jan 18, 2011 at 4:04 PM


I would like to keep configuration files under source control (web.config, app.config) to deploy them (depending on target) on deployment machines.

I was thinking to store them in source control, and i wonder whether is any way to get them by power shell

Any ideas?

Jan 19, 2011 at 5:04 AM


Firstly, if you'd like to retrieve individual files from TFS source control from inside a PowerShell script, here is a snippet of how to do it:

If you like to retrieve an entire folder, just translate some of the C# code from TFS Deployer's own VersionControlDeploymentFolderSource class.

However, typically you need to use the same set of config files associated with the version of the source used in the build you are deploying and for this reason I tend to prefer customising the build process to copy all the config files for all environments into the build drop folder at build time. This way deployment scripts can very easily grab the required config files from the same place as the binaries.



Jan 19, 2011 at 7:16 AM

Hi Jason,

Thanks for such a quick answer. I was able to run TFS Deployer yesterday, and I'm impressed with results. I guess you feel really proud, and I assume you have spent a lot of hours to release such amazing work.

What I like the most is deployment is particularized for each machine and, due to our product characteristics, we need to have different config files depending on machine (different settings, WCF configuration... to extensive to explain it in just a few words).

Our idea is replacing default config files.

I'm going to open an issue so (may be) for future releases, you would like to add a list of deployable items from configuration despite those operations can be performed by configuring mapping.

Again, thanks for your work