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.
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.
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".
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>
© 2022 - 2024 — McMap. All rights reserved.