Share via


How to: Exclude Files from a Database Project

You can temporarily exclude a file from a database project to ignore it at build and deployment time. You might exclude a file, for example, if you want to build and deploy part of your database to your isolated development environment, but several of your objects contain build errors. When you exclude a file from the database project, the object that is defined in that file disappears from Schema View if that file's Build Action property is set to Build. Any objects that depend on the excluded object appear with an error state (a red exclamation point).

Note

You can also mark a file so that it will not be included in the build by changing the Build Action property to Not in Build.

To temporarily exclude an item from a database project

  1. In Solution Explorer, click the item that you want to exclude from your database project.

  2. On the Project menu, click Exclude from Project.

    If you have not chosen to show all files, the file disappears from Solution Explorer. The file has not been deleted from disk. If you have chosen to show all files, the icon that is associated with the file in Solution Explorer is dimmed, which indicates that the file is excluded.

    Note

    To toggle whether all files are shown, open the Project menu and click Show All Files or click Show All Files on the Solution Explorer toolbar.

To include an item that was previously excluded from a database project

  1. If all files are not shown, open the Project menu and click Show All Files.

    Excluded items appear with dimmed icons.

  2. Click the excluded item that you want to include in the database project build.

  3. On the Project menu, click Include In Project.

    The item is included in the project. The icon for the item is undimmed. When you rebuild the database project, that item is included in the build script.

See Also

Tasks

How to: Build a Database Project to Generate a Compiled Schema (.dbschema) File

How to: Delete Database Objects

Concepts

An Overview of Database and Server Projects

Creating and Modify Database and Server Objects