How to: Exclude a File from Source Control

If the solution you are working on contains files that do not require source control, you can use the Exclude from Source Control command to mark the file accordingly. When you do this, the file remains in the database, but it is no longer checked in or out with the containing project.


Generated files are excluded from source control by default. A generated file is one that can be entirely recreated by Visual Studio, based on the contents of another Visual Studio file.

To exclude a file from source control

  1. In Visual Studio, open Solution Explorer and select the file to exclude.

  2. On the File menu, click Source Control, then click Exclude from Source Control.

  3. When you are ready to place the file under source control, you can access the File menu and click Source Control, then uncheck Exclude from Source Control.

See Also

Other Resources

Performing Source Control Tasks