创建发布预览时的 SSDT 发布错误 [英] SSDT Publish errors on Creating Publish Preview

查看:31
本文介绍了创建发布预览时的 SSDT 发布错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Visual Studio 2013 来管理包含我们的数据库架构的 .sqlproj 文件.该架构已成功部署数十次.

I am using Visual Studio 2013 to manage a .sqlproj file containing our database schema. The schema has been deployed successfully dozens of times.

尝试发布到一个特定的目标数据库时,创建发布预览"步骤似乎失败,但没有给出错误.预览的输出包括一些预期的警告:

When attempting to publish to one specific target database, the "Creating publish preview" step appears to fail, but no error is given. The output from the preview includes some expected warnings:

  • 列 {...} 正在被删除,可能会发生数据丢失
  • 如果执行此部署,对 {...} 的更改可能会在 {...} 中引入运行时错误
  • 此部署在执行过程中可能会遇到错误,因为对 {...} 的更改被目标数据库中的 {...} 依赖项阻止

我已取消选中如果可能发生数据丢失,则阻止增量部署".

I have unchecked "Block incremental deployment if data loss might occur".

预览只是停止,没有生成脚本.

The Preview just stops, and no script is generated.

推荐答案

当目标数据库中存在未包含在您的 sqlproj 中的存储过程(或视图或约束或其他对象)时,会发生这种情况将通过部署 sqlproj 更改的表.SSDT 显然无法确定更改是否安全,除非您的 sqlproj 中包含引用的内容,然后它会通过阻止部署而在安全方面出错.

This happens when there exists a stored procedure (or view or constraint or other object) in the target database, that isn't included in your sqlproj, that references a table that would be altered by deploying your sqlproj. SSDT apparently can't determine whether the change is safe unless the referring thing is included in your sqlproj, and then it errs on the safe side by blocking the deployment.

禁用如果可能发生数据丢失则阻止增量部署"选项只会放宽数据丢失检查.没有如果可能发生运行时错误,则阻止增量部署"选项.

Disabling the "Block incremental deployment if data loss might occur" option only relaxes the data-loss checks. There isn't a "Block incremental deployment if run-time errors might occur" option.

您有三个选择:

  1. 将目标数据库中的任何存储过程、视图或任何内容添加到您的 sqlproj

  1. add whatever stored procedures, views, or whatever from the target database to your sqlproj

取消选中 ssdt 发布选项中的验证部署"选项(这很危险,除非您知道其他引用 sproc 并且知道它们不会中断)

uncheck the "Verify Deployment" option in the ssdt publish options (this is dangerous unless you're aware of the other referring sprocs and know that they aren't going to break)

如果您确定应该存在于目标数据库中的所有内容都包含在您的 sqlproj 中,您可以启用将对象放入目标但不在源中"选项

if you're certain that everything that should exist in the target database is contained in your sqlproj, you can enabled the "Drop objects in target but not in source" option

这篇关于创建发布预览时的 SSDT 发布错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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