30

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 4

40

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.

Where to find the Build Configuration drop down

Select Configuration Manager from the drop down

Uncheck Deploy for the relevant project

Sign up to request clarification or add additional context in comments.

1 Comment

It depends on what the OP meant, but if he did not want any deployment actions to occur (including generating a SQL script, in the case of the accepted answer above), this is the correct answer. Thank you!
4

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

The Deploy tab is not present in VS 11 Beta. There is a "Create Script" checkbox on the Project Settings tab, but checking this still results in the database being deployed. Any more clues?
If no deployment actions should be taken, it should be disabled in the Configuration Manager. See other answer.
4

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

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.