数据库项目(DACPAC)的问题-持续交付 [英] Issue with Database project (DACPAC) - Continuous delivery

查看:94
本文介绍了数据库项目(DACPAC)的问题-持续交付的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Microsoft TFS生成过程,可以将Web项目部署到天蓝色的Web角色,这种情况每天都会自动发生.我已关注Azure文章 https://azure.microsoft.com/zh-CN/documentation/articles/cloud-services-dotnet-continuous-delivery/

I have Microsoft TFS build process to deploy web project to azure web role, this occurs automated way every day. I have followed Azure article https://azure.microsoft.com/en-in/documentation/articles/cloud-services-dotnet-continuous-delivery/

我在构建过程中遵循了MSBuild参数,如上面的文章所述

I have following MSBuild arguments in my build process, as above article suggested

/t:Publish /p:PublishDir=C:\MSCD\

当我将数据库项目添加到我的项目解决方案时,构建一直失败.收到错误消息

When i add database project to my project solution, build is keep failing. Getting error message

未为"SqlPublishTask"任务提供所需值 参数"SqlPublishProfilePath"

The "SqlPublishTask" task was not given a value for the required parameter "SqlPublishProfilePath"

发布Web项目时,我不希望发布数据库项目.如何将DACPAC文件拖放到drop文件夹?这样我就可以使用Powershell在天蓝色的情况下更新数据库.

When i publish my web project, i don't want database project to be published. How to drop DACPAC file to drop folder ? so i can use powershell to update my database in azure.

我正在使用TFS 2012内部部署.有人可以对如何解决这个问题提出建议吗?

I am using TFS 2012 On-Premise. Could someone give suggestion on how to solve this problem?

推荐答案

@Siva palla的答案解决了这个完全相同的问题为我.这是我们为完成此工作而进行的完整更改的集合.

@Siva palla's answer solved this exact same issue for me. Here are the complete set of changes we made to get this working.

Visual Studio中的更改

最初,我使用的是一个名为"Deployment"的配置,该配置用于部署我们的WinForms项目和SQL项目(VisionShellWin是WinForms项目,两个Vision.SQLMigration项目是SSDT项目),因此下面的内容都是基于关于部署的更改.对于大多数人而言,您将拥有发行版"而不是部署",以下所有内容仍然可以正常工作,只需用发行版"代替部署"即可:

Originally I was using a single configuration called 'Deployment' that was set to deploy both our WinForms project and our SQL project (VisionShellWin is the WinForms project, the two Vision.SQLMigration projects are the SSDT projects) so everything below is based on changes to Deployment. For most people you'll have Release instead of Deployment, all of the below should still work fine, just substitute in Release for Deployment:

要将该单一配置一分为二,我创建了一个新配置:

To separate that single configuration in two I created a new configuration:

我将新部署设置为从旧的部署"配置复制其设置,而不是为每个项目创建新配置(现有的项目级别部署"都可以):

I set that new deployment to copy its settings from the old Deployment configuration and not to create new configurations for each of the projects (the existing project level Deployment ones are fine):

然后在该新部署中,取消选中用于构建和部署数据库项目的框:

In that new deployment I then unticked the boxes to Build and Deploy the database projects:

然后我再次做完全相同的事情来创建特定于数据库的部署:

I then did the exact same thing again to create a Database specific deployment:

在那一个中​​,我取消了除数据库文件之外的所有内容:

And in that one I unticked everything except the database files:

这是Visual Studio所需的一切,因此我将所有内容提交并同步回DevOps.

That's everything needed in Visual Studio, so I committed all of that and synced it back to DevOps.

Azure DevOps中的更改

在DevOps中,我克隆了现有的Visual Studio Build阶段(称为"Build Winforms解决方案"),并将克隆重命名为Build Databases:

In DevOps I cloned my existing Visual Studio Build stage (called 'Build Winforms solution') and renamed the clone to Build Databases:

我在变量"选项卡中添加了两个新的构建变量,名为ClickOnceBuildStageConfiguration和DatabasesBuildStageConfiguration,其值设置为我们刚刚在VS中创建的新配置的名称:

I added two new build variables in the Variables tab, named ClickOnceBuildStageConfiguration and DatabasesBuildStageConfiguration with their values set to the names of the new configurations we just created in VS:

然后我将WinForms构建阶段更改为使用新的ClickOnceBuildStageConfiguration变量-请注意,我们仍然设置了ClickOnce所需的/T:"VisionShellWin" /target:Publish MSBuild参数:

And then I changed the WinForms build stage to use the new ClickOnceBuildStageConfiguration variable - note that we still have the /T:"VisionShellWin" /target:Publish MSBuild Arguments needed for ClickOnce set:

以及使用数据库变量的新构建数据库阶段-请注意,我们没有任何MSBuild参数:

And the new Build Databases stage to use the databases variable - note that we don't have any MSBuild Arguments:

最后,除了复制阶段外,我还具有将ClickOnce应用程序文件复制到drop工件中的功能:

Finally, in addition to the copy stage I already had for copying the ClickOnce application files into the drop artifact:

我还添加了一个复制文件"阶段(称为复制Dacpacs"),也将DacPac复制到了下拉菜单中:

I also added a Copy Files stage (called 'Copy Dacpacs') to copy the DacPac into the drop too:

完成所有这些操作后,您应该以可以正常工作的构建和包含ClickOnce文件和DacPacs的构件结束

Once you've done all of that, you should end up with a build that works and an artifact that contains both the ClickOnce files and the DacPacs

这篇关于数据库项目(DACPAC)的问题-持续交付的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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