Bagikan melalui


How to: Import and Export Partial Database Projects

You can both share database objects between database projects and manage write access to those objects with more precision by exporting them into a partial project. If you then import the partial project into another database project, developers can use the objects in both projects. However, you can apply permissions in version control so that only developers who have write access to the original database project can update the objects that you exported. For more information, see Starting Team Development of Large Databases.

To export one or more objects as a partial project

  1. Open the solution that contains the database project from which you want to export objects.

  2. In Solution Explorer, right-click the object or group of objects that you want to export.

    For example, you can export all of the tables in the dbo schema by expanding the database project, expanding the Schema Objects node, expanding the Schemas node, expanding the dbo node, and right-clicking Tables.

  3. Click Export as Partial Project.

  4. In the Save As dialog box, browse to the folder in which you want to create the .files file that represents the partial project.

  5. In File name, type the name that you want to give the partial project, and click Save.

    A file is created with the .files extension in the path that you specified. The file contains the file names and paths of all objects that you specified.

To import a partial project

  1. Open the solution that contains the database project into which you want to import a partial project.

  2. In Solution Explorer, right-click the project, and then click Import Partial Project.

  3. In the confirmation dialog box, click Yes to unload and reload your database project.

  4. In the Open dialog box, browse to the folder that contains the .files file that you exported, click it, and then click Open.

    Important

    You must have read access to the .files file and to the original files referenced from the .files file. If you do not have access, an error will appear when you click Open.

    A folder that has the name ProjectNameBasePath is added to your database project, where ProjectName is the name of the project from which you exported the partial project. You can now refer to the imported objects from other object definitions. When you build and deploy the database project, the imported objects will be included.

    Important

    Your database project will not build successfully if you import a partial project that contains objects that refer to other objects that are not defined in your database project.

See Also

Tasks

Walkthrough: Partition a Database Project by Using Partial Projects

Walkthrough: Partition a Database Project by Using Composite Projects

Concepts

Starting Team Development of Large Databases