Share via


Converting between Data-tier Application Projects and Database Projects

After you create a data-tier application (DAC) project or a database project, you might want to change between those project types. For example, if you started with a DAC project, but then needed to use language constructs that are not supported in a DAC project, you might want to change project types.

Note

For more information, see the following page on the Microsoft Web site: Features in Data-tier Applications.

Similarly, if you have a database project that only uses objects that are supported by DAC projects, you might decide to convert your project. After you change the project type, you have to perform one or more manual steps before you can successfully build and deploy the updated project.

In this topic

  • Changing Project Type

  • Manual Steps Required When Converting to a Database Project

  • Manual Steps Required When Converting to a DAC Project

Changing Project Type

To change the type of your project

  1. In Solution Explorer, click the project whose type you want to change.

  2. On the Project menu, click ProjectName Properties.

  3. On the Project Settings tab, in Project version, click the new type that you want to apply to the project. For example, to change the project to a data-tier application project, click Data-tier Application.

  4. In the confirmation dialog box, click Yes to change the type and reload the project. If you click No, the project type is reverted to its previous value.

Manual Steps Required When Converting to a Database Project

After you change the type of a data-tier application project to a database project, you should address the following issues:

Issue

User Action

Notes

Unnecessary .sqlpolicy files

Optional

Because the build action of the .sqlpolicy files is set to 'DACPropertiesFile', those files are ignored when you build and deploy a project if it is not a DAC project. You can remove those files if you do not plan to change the project back to a DAC project.

Missing deployment properties file (.sqldeployment)

Optional

You can add at least one .sqldeployment file before you can deploy the database project.

Missing SQLCMD variables file (.sqlcmdvars)

Optional

You can add a Database.sqlcmdvars file if you want to define additional SQLCMD variables for use in your project.

Missing permissions file (.sqlpermissions)

Optional

You can add a Database.sqlpermissions file if you want to define permissions for the objects in your database.

Fewer catalog properties in Database.sqlsettings.

Optional

DAC projects expose fewer catalog properties in their Database.sqlsettings file. If you do not want to accept the default values for the other properties, you should review them before you build and deploy your project.

Adding Properties Files to Database Projects

If you create a new database project, it contains four properties files: Database.sqlcmdvars, Database.sqldeployment, Database.sqlpermissions, and Database.sqlsettings. When you convert a DAC project, only Database.sqlsettings exists in the resulting project. You must manually add the other files to your project.

To add a properties file to your database project

  1. In Solution Explorer, right-click the Properties folder of your database project, point to Add, and click the property file that you want to add to your database project. For example, to add Database.sqldeployment, click Deployment Configuration.

  2. In the Add New Item dialog box, verify that the properties template that you want to add is highlighted.

  3. In Name, specify the name that you want to give the file.

  4. Click Add.

  5. Adjust any property values that you want to change.

  6. On the File menu, click Save Filename, where Filename is the name of the file that you are changing.

  7. To review or update properties that are contained in the properties file, expand the Properties folder in Solution Explorer, and double-click the properties file that you want to review or update.

Manual Steps Required When Converting to a DAC Project

After you change the type of a database project to a DAC project, you should address the following issues:

Issue

User Action

Notes

Missing ServerSelection.sqlpolicy file

Required

A database project does not contain any .sqlpolicy files. Before you can deploy your DAC project, you must create a .sqlpolicy file.

Unsupported object types

Required

DAC projects only support a subset of the objects that you might have in a database project. For example, XML indexes are not supported. For more information, see the following page on the Microsoft Web site: Features Supported in Data-tier Applications. You should build your DAC project after you change the project type to identify any unsupported objects types that are defined in your project. For more information, see How to: Build a Database Project to Generate a Compiled Schema (.dbschema) File.

Unnecessary properties files

Optional

DAC projects do not use the .sqlcmdvars, .sqldeployment, or .sqlpermissions properties files. You can safely remove those files if you do not plan to change your project type back to a database project.

Policy File for Data-tier Application Projects

To add a .sqlpolicy file to your DAC project

  1. In Solution Explorer, right-click the Properties folder of your DAC project, point to Add, and then click Sql Policy.

  2. In the Add New Item dialog box, verify that the .sqlpolicy template that you want to add is highlighted.

  3. In Name, specify the name that you want to give the file.

  4. Click Add.

  5. Create the verification policy that will be performed before your project can be deployed. For more information, see Configuring the Server Selection Policy.

  6. On the File menu, click Save Filename.

See Also

Tasks

How to: Create Database and Server Projects

Concepts

Writing and Changing Database Code

Starting Team Database Development