TFS 2008, remove file from source control but leave it in the project

tfs, version-control, web-config

Solution

By adding a new file to solution explorer, you will get the little plus sign indicating it is due to be added to source control. Then, right-click and choose "undo pending changes". This will cancel the add but leave the file in your project.

If that doesn't work I suggest one of the following methods:

- Use the Attrib task from the MSBuild Community Tasks project to remove the read only flag.

- Use the Exec task in MSBuild to invoke tf.exe and checkout the file.

Problem

We are using Scott Hansleman's suggestion for multiple web.configs from his post here. The problem we have is that we have to check out the Web.Config. If we remove it from the project, when we publish, no web.config is pushed. So we need to remove the source control bindings just from the web.config, but leave it in the project, and have the rest of the project still held under source control. The issue is that source control makes the file read only until you check it out. We need to be able ot overwrite it with the prebuild events, preferably without having to check it out. Is there a way to remove the bindings from that file only, and still leave it as part of the project? Thanks.

Original source