VS 2008 Database Project - During Deploy 'DatabaseName' undefined

老子叫甜甜 提交于 2019-12-13 02:43:55

问题


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.


回答1:


Found it!

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




回答2:


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.



来源:https://stackoverflow.com/questions/15140053/vs-2008-database-project-during-deploy-databasename-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!