I’ve got a VS/TFS2010 project in which we use a generated file. Here’s how it works:
- There’s a pre-build event that creates the file (foo.cs)
- The file is included in the project.
- The file is NEVER added to TFS version control.
It works great, except… People have an unfortunate habit of accidentally checking in the file. This, of course, breaks the system.
Are there any good ways to prevent this from happening? Can I at least set up some kind of watch mechanism to alert me if it does happen?
You’ll need to install the Team Foundation Server Power Tools, which will include the “Forbidden Patterns” check-in policy. This will allow you to prohibit a file from being checked in based on regular expression applied to the server path.
This will allow you to simply add the full server path of the file you wish to ensure does not get added. For example: