VS 2008数据库项目-部署期间“ DatabaseName”未定义 [英] VS 2008 Database Project - During Deploy 'DatabaseName' undefined

查看:127
本文介绍了VS 2008数据库项目-部署期间“ DatabaseName”未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS 2008,并且继承了我要部署的数据库项目。我正在做的部署是到一个新的数据库。 (就像我要安装新安装一样)

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)

部署操作是:创建Scrip并部署到数据库。

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

我收到以下错误:Schema.dbschema(0,0)错误TSD01268:SQL执行错误:发生致命错误。找不到变量DatabaseName。

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.

DatabaseName是在项目属性中定义的。

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.

推荐答案

找到了!

在Database.sqldeployment中,高级选项下有一个名为 CommentOutSetVarDeclarations的选项。

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

这篇关于VS 2008数据库项目-部署期间“ DatabaseName”未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆