Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore certain file from pending changes

Here is my problem. I have a certain files from the solution (let's say Web.config) that I've changed and will never want to check-in since the changes are referring to my machine only. Is there a way to say in TFS to ignore changes in a certain file and remove it from pending changes window. Of course, I can skip this file in every check-in, but there is always a change to forget and check-in by mistake. For example, there is a similar ignore list in AnkhSVN.

like image 204
anthares Avatar asked Oct 07 '10 14:10

anthares


3 Answers

Some parts of {app,web}.config files can be delegated to another file. Notably <connectionStrings>.

In your app.config or web.config:

<connectionStrings configSource="LocalConnectionStrings.config" />

in LocalConnectionStrings.config have (<connectionStrings> is the root element):

<connectionStrings>
    <!-- For the application's operations. -->
    <add name="Application"
         connectionString="Data Source=server;Initial Catalog=database;Integrated Security=True;Network Library=dbmssocn"
         providerName="System.Data.SqlClient" />
</connectionStrings>

Thus each developer has a LocalConnectionStrings.config which is in the project, but not in source control set with their private settings while the {web,app}.config has shared settings. Unfortunately this only works with a limited set of system defined configuration elements.

like image 100
Richard Avatar answered Sep 28 '22 22:09

Richard


One workaround could be to remove the readonly attribute on the web.config in the windows explorer then edit it in notepad:

  • It won't appear in the pending changes
  • It's still in the source control

Ugly but simple solution.

like image 36
Olivier Payen Avatar answered Sep 28 '22 23:09

Olivier Payen


The best practice concerning configuration files, TFS and different developer machines is (hem hem)...

All your developers should have the same dev environment. It's the only way to manage web.config files in TFS, and it has a lot of added benefits:

  • Nomore "but it work on my computer"

  • its friend the dreaded "I don't understand what dependencies are required. It doesn't compile anymore."

  • You won't regret the famous "Ah! I forgot to tell you, I invented a MyWonderfullApplicationConfigSection and you should define it in your web.config, but I won't tell you how."

  • It will really help setting up a build environment or a deployment.

Ok, it isn't really easy, I know that different developers like different settings... but it's a good idea to standardize the dev platform. It's really worth it.

like image 20
Eilistraee Avatar answered Sep 29 '22 00:09

Eilistraee