tags:

views:

2031

answers:

3

We have mutiple config files (app.DEV.config, app.TEST.config, etc) and a pre-build event that copies the correct config file to app.config. Obviously the configuration specific files are in source control --- but at the moment so is App.Config, and that shouldn't be.

How can I mark that one file as excluded from source control, but obviously not from the project.

I'm using VS 2005, and 2005 Team Explorer.

+1  A: 

TFS allows you to cloak at the folder/file level. When something is cloaked, TFS won't attempt to sync it (much like a svn:ignore).

When setting up your workspace, cloak anything you want TFS to ignore. A more detailed how-to is here.

joshua.ewer
+3  A: 

If all you want is to have a file in the project but not under source control with TFS, just go into SourceControl, delete the said file, and undo your checkout of the project file (it will attempt to remove the file from the project as well). Then check-in your delete of the file you are excluding. In the solution explorer you should see that there is no source control icon next to the file you're excluding. The project file should list a file there, but that file should now no longer be under source control.

Keep in mind, any other person will now see a missing file in the project when they get latest.

Seth
+4  A: 

There is a checkin policy in the MS Power Tools which lets you screen filenames against a regular expression. See: http://msdn.microsoft.com/en-us/teamsystem/bb980963.aspx#checkin While checkin policies are not completely foolproof, they are the closest thing TFS has to enforcing user-defined rules like what you're looking for.

If you just want to exclude a single file from Source Control, then select it in the Solution Explorer and choose "Exclude from Source Control" from the File>Source Control menu.

(And as the others have said, you can also cloak a file or folder, which means it stays in Source Control and is visible to everyone else on the team, but it's not copied to your PC until you decide to uncloak it; or you can delete the file, which means it gets deleted from everybody's PCs when they get latest - but neither of these options will prevent such files being added to source control in the first place)

Jason Williams
The team-project-wide exclusion feature you're describing doesn't exist in TFS, unfortunately. (unless it's in a more recent build of 2010 than mine) The "Source Control File Types" dialog controls which file types are non-mergeable, i.e. locked exclusively.
Richard Berg
I have VSTS2005/2008 at work, but am writing this at home, so my answer was from my rather poor memory - sorry! Just realised that what you need is the TFS Power Tools "forbidden patterns" check in policy. This allows you to match filenames using a regex and block checkins of unwanted filenames: http://msdn.microsoft.com/en-us/teamsystem/bb980963.aspx#checkin
Jason Williams
Good call, I'd forgotten about that policy. I'll edit your post to give it visibility.
Richard Berg