1

I am using VS 2008 and have inhertied a database project that I am trying to deploy. The deploy I am doing is to a new database. (as if I were setting up a new installation)

The Deploy Action is: Create Scrip and deploy to Database.

I get the following error: Schema.dbschema(0,0)Error TSD01268: SQL Execution error: A fatal error occurred. The variable DatabaseName could not be found.

The DatabaseName is defined in the project properties.

If I look a the deployment script I see the declaration is commented out. I can remove the comment and run the script manualy and it works, but when I regenerate the script the declaration is commented out again.

/*
:setvar DatabaseName "TestDb"
:setvar DefaultDataPath "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\"
*/
GO

I have searched for a setting that would cause the declaration to be commented out, but haven't found anything.

I want to be able to run the deployment script without editing it everytime.

2 Answers2

3

Found it!

In Database.sqldeployment there is an option under Advanced Options called "CommentOutSetVarDeclarations".

0

Have you specified in the project settings that you wish to always re-create the database when deploying? IF not, try setting this option to see if that resolves this for you. See this MSDN article for more details.

Tim Lentine
  • 7,782
  • 5
  • 35
  • 40
  • I changed the setting to alway re-create the database when deploying, but it had no effect. Thanks for point out that setting to me, however, I will be useful. – Marc Riffel Feb 28 '13 at 17:48
  • 1
    Found it! Thanks TIm for pointing me to the right place. In Database.sqldeployment there is an option under Advanced Options called "CommentOutSetVarDeclarations". – Marc Riffel Feb 28 '13 at 19:02