I have a web.config that occasionally I'll checkout and modify to use a hardcoded password instead of reading it from the registry.
How can I prevent myself from absent-mindedly checking it back in and annoying my co-workers?
I could achieve this in the past with Perforce by creating a separate pending changelist.
edit - I'd rather not make it writable, I was wondering if there's anything in TFS or planned for TFS to support this?
Here is a solution:
1) Right click on the file (in Source Control Explorer) and select properties.
2) Then go to security and add your self (make sure you select the user radio button)
3) Then deny yourself checkin rights. (Click the deny checkbox under checkin)
This will stop you from checking in the file. To be able to check it in later just do these steps again, but select the Allow check box.
Note: you may need to get your administrator to give you "Manipulate Security Settings" for that file (done the same as above, but in step 3 select allow under "Manipulate Security Setting".)
Option 1: You could just make the web.config
writeable locally without checking out (this would be helped by setting VS to prompt for checkout).
Option 2: Move the password out of the web.config. Using a configSource
attribute to put that configuration into a local, not in TFS, file. Each developer then maintains their own copy.
E.g. in web.config
:
<configuration>
...
<connectionStrings configSource="LocalConnectionStrings.config"/>
</configuration>
and in LocalConnectionStrings.config
:
<connectionStrings>
<add name="MyConnectionString"
connectionString="Data Source=.;Initial Catalog=Test1;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
NB. configSource
is implemented by ASP.NET's config runtime and is supported on all configuration elements for ASP.NET (and, thus, not for arbitrary (including custom) configuration elements).
(Also note the <linkedConfiguration> Element
provides another include mechanism, but is limited to assemblyBinding
element.)
Source controlled items by TFS use the 'Read Only' attribute of the file to evaluate file status. You can go to the physical folder where the web.config exists in your machine through the explorer. Make sure your web.config is checked in before you begin. Then :
You would have to do a get specific on the file to get any changes from TFS after that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With