How to: Update an Existing Model Using Visual Studio
[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]
Visual Studio 2010 allows you to write models using Microsoft code name “M” and then deploy those models to a SQL Server database. For examples and details on this process, see Getting Started Tutorials.
To verify the M Deployment settings for a Visual Studio 2010 project
Open the Visual Studio 2010 project that contains the target “M” model.
Right-click the project in Solution Explorer, and then click Properties.
In the M Deployment section, verify that the connection string targets a valid SQL Server database.
To deploy a new version of the model to the target database
Make any necessary changes to the models in your “M” files.
On the File menu, click Save All.
Right-click the project in Solution Explorer, and then click Deploy.
Tip
If you do not make any changes to the project since the last deployment, then the deployment step will do nothing. This is true even if the model has been manually removed from the target database. To successfully deploy in this case, go to the Build menu and click Rebuild Solution. Then perform the deployment.
Warning
The target database specified in the “M” deployment settings must exist. Deploying a model does not create the target database for you.
F5 Auto-deployment
When debugging a project that contains “M” models, the models are automatically deployed to the database before the debug session begins. Because F5 is a common way to begin debugging, this process is referred to as F5 auto-deployment.
To use F5 auto-deployment, you must be working with a project that can be debugged. For example, a SQL Server Modeling CTP project that only contains “M” files cannot be debugged, because there is no executable code. This feature does not detect changes to the target database that are made outside of the Visual Studio 2010 project. If the models in the database are removed manually but no other project changes are made, model deployment would not be initiated at the beginning of the debug session. Instead, F5 auto-deployment occurs when debugging the application after any build, even if the “M” code for the project's models has not changed.
To use F5 Auto-deployment
Open a project in Visual Studio that contains “M” models.
Verify that the “M” deployment settings are correct in the project properties.
Press F5 to debug the current project. The models are automatically deployed to the target database that is specified by the “M” deployment settings.