VSTS:部署Azure SQL DACPAC版本管理会引发错误 [英] VSTS: Deploy Azure SQL DACPAC Release Management throwing an error

本文介绍了VSTS:部署Azure SQL DACPAC版本管理会引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的Azure SQL数据库设置VSTS发布管理.我正在使用部署Azure SQL DACPAC"任务. dacpac文件的路径设置为

I am trying to setup VSTS release management for my Azure SQL database. I am using the "Deploy Azure SQL DACPAC" task. Path to the dacpac file is setup as

$(System.DefaultWorkingDirectory)\**\*.dacpac

虽然数据库正确更新,但最后却出现错误,导致任务失败.

While the database updates correctly I get an error in the end that causes the task to fail.

"System.Management.Automation.ParentContainsErrorRecordException: *** Could not deploy package"

看起来所有更新都已应用到数据库,但是任务仍然引发错误.在下面登录

It looks like all the updates are applied to the database but the task still throws an error. Log below

2016-07-07T07:50:44.6118522Z Publishing to database 'mydb' on server 'myserver.database.windows.net'.
2016-07-07T07:50:45.7587428Z Initializing deployment (Start)
2016-07-07T07:50:52.5825349Z Initializing deployment (Complete)
2016-07-07T07:50:52.5835341Z Analyzing deployment plan (Start)
2016-07-07T07:50:52.7085342Z Analyzing deployment plan (Complete)
2016-07-07T07:50:52.7085342Z Updating database (Start)
2016-07-07T07:50:53.7000358Z Altering [dbo].[usp_Products_List]...
2016-07-07T07:50:53.7170379Z Creating [dbo].[usp_Products_GetById]...
2016-07-07T07:50:53.8745919Z An error occurred while the batch was being executed.
2016-07-07T07:50:53.8855912Z Updating database (Failed)
2016-07-07T07:50:53.9105905Z ##[debug]System.Management.Automation.RemoteException: *** Could not deploy package.
2016-07-07T07:50:53.9225921Z ##[debug][Azure RDFE Call] Deleting firewall rule 260745ad-327c-45ae-bcb8-5c6bb0e43797 on azure database server: myserver
2016-07-07T07:50:55.9753040Z ##[debug][Azure RDFE Call] Firewall rule 260745ad-327c-45ae-bcb8-5c6bb0e43797 deleted on azure database server: myserver
2016-07-07T07:50:55.9934761Z ##[error]System.Management.Automation.ParentContainsErrorRecordException: *** Could not deploy package.

存储过程代码

CREATE PROCEDURE [dbo].[usp_Products_GetById]
    @pId int
AS
    SET NOCOUNT ON;

SELECT [id]
      ,[description]
      ,[created_dt]
      ,[last_mod_dt]
      ,[active]
  FROM [dbo].[Products]
  WHERE [id] = @pId
GO

推荐答案

在我的特殊情况下,发生此错误是因为在我的数据库项目中,在一个表的初始化脚本中,我试图为以下项设置身份规范:一个非数字列.

In my particular case, this error happened because in my database project, in one of the init scripts for a table, I was trying to set the identity specification for a non-numeric column.

因此,如果其他解决方案不起作用,请检查所有脚本运行是否正确(使用SQL Management Studio或Visual Studio).

So, check that all your scripts run without errors (using SQL Management Studio or Visual Studio) if the other solutions don't work.

很遗憾,VSTS中的错误无法捕获SQL错误...

Too bad that the error in VSTS doesn't capture the SQL error...

这篇关于VSTS:部署Azure SQL DACPAC版本管理会引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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