I'm using Visual Studio 11 Beta with a SQL Server Database project and a console app project. Every time I hit F5 to debug my console app, it wants to deploy the database project. Is there any way to keep it from doing that? I can't find any settings to prevent it.
4 Answers
The problem here is that when you say I want to build and deploy (hitting F5 does this in order to debug) you don't actually want the DB to be part of that deployment.
I'm afraid I don't have VS 11 Beta, but this is achieved by disabling the Deploy of the project in the Build Configuration.
Below is a screenshot from VS 2010, hopefully you can find an equivalent (sorry, I couldn't find the MS documentation for 2012).
Find the project you don't want to deploy, and uncheck the relevant check box under the Deploy column.



1 Comment
Double-click on the Properties node of the Database project in Solution Explorer to open the Database project properties. Select the Deploy tab. In the Deploy action section, select "Create a deployment script (.sql)" instead of "Create a deployment script (.sql) and deploy to the database".
2 Comments
I had a similar problem in Visual Studio 2022, where my console app had a configured dependency on my .sqlproj. Each time I ran the console app, the .sqlproj tried to deploy.
None of the other answers above seem to be available in VS2022 (the "Deploy" checkbox is greyed out, and there's no UI for the "deployment action").
My "fix" (hack) is to override the imported "Deploy" target with a log message (I never want to deploy anyway, I just want the dacpac).
In the .sqlproj file, find the place where Microsoft.Data.Tools.Schema.SqlTasks.targets is imported, then below this, override the "Deploy" target with a "message only" target:
<Target Name="Deploy">
<Message
Importance="High"
Text="Deployment disabled. This project is never deployed manually. Deployment is performed by applying the dacpac."></Message>
</Target>
Comments
Open the .sln file.
Find the uid of the project:
Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "Database",
"Database\Database.sqlproj", "{DBA6666F-890B-42DA-A650-7A49A06D6FBB}"
This Database Project have uid = {DBA6666F-890B-42DA-A650-7A49A06D6FBB}
Then find and remove this line:
{DBA6666F-890B-42DA-A650-7A49A06D6FBB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
Done! No more deploy when debugging.
When you select deploy checkbox, this line is inserted, when you uncheck, this line is removed. But if checkbox is disabled, you need to remove/add the line manually.