简体   繁体   English

数据库项目(DACPAC)的问题-持续交付

[英]Issue with Database project (DACPAC) - Continuous delivery

I have Microsoft TFS build process to deploy web project to azure web role, this occurs automated way every day. 我有Microsoft TFS生成过程,可以将Web项目部署到Azure Web角色,这种情况每天都会自动发生。 I have followed Azure article https://azure.microsoft.com/en-in/documentation/articles/cloud-services-dotnet-continuous-delivery/ 我已关注Azure文章https://azure.microsoft.com/en-in/documentation/articles/cloud-services-dotnet-continuous-delivery/

I have following MSBuild arguments in my build process, as above article suggested 如上文章所述,我在构建过程中遵循了MSBuild参数

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

When i add database project to my project solution, build is keep failing. 当我将数据库项目添加到我的项目解决方案时,构建一直失败。 Getting error message 收到错误消息

The "SqlPublishTask" task was not given a value for the required parameter "SqlPublishProfilePath" 没有为“ SqlPublishTask”任务提供必需参数“ SqlPublishProfilePath”的值

When i publish my web project, i don't want database project to be published. 发布Web项目时,我不希望发布数据库项目。 How to drop DACPAC file to drop folder ? 如何将DACPAC文件drop到文件夹? so i can use powershell to update my database in azure. 所以我可以使用Powershell在天蓝色的情况下更新我的数据库。

I am using TFS 2012 On-Premise. 我正在使用TFS 2012内部部署。 Could someone give suggestion on how to solve this problem? 有人可以对如何解决这个问题提出建议吗?

You need to create Master-child build definitions and in master build definition configure solution with build and deploy disabled in configuration manager .and in child build configure database project alone . 您需要创建Master-child构建定义,并在master build definition中配置配置解决方案,并在Configuration Manager中禁用构建和部署。

Create Master and child build definition such that they share common drop . 创建母版和子版的定义,使它们共享共同的下落。

@Siva palla's answer solved this exact same issue for me. @Siva palla的回答为我解决了这个完全相同的问题。 Here are the complete set of changes we made to get this working. 这是我们为完成此工作而进行的完整更改的集合。

Changes in Visual Studio Visual Studio中的更改

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. 最初,我使用的是称为“ Deployment”的单个配置,该配置用于部署我们的WinForms项目和SQL项目(VisionShellWin是WinForms项目,两个Vision.SQLMigration项目是SSDT项目),因此下面的内容都是基于对部署。 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: 然后,在该新部署中,我取消选中用于构建和部署数据库项目的框:

SSDT项目的配置未打勾

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: 在那一本书中,我取消了除数据库文件以外的所有内容:

在此处输入图片说明

That's everything needed in Visual Studio, so I committed all of that and synced it back to DevOps. 这是Visual Studio所需的一切,因此我将所有内容都提交了,并将其同步回DevOps。

Changes in Azure DevOps Azure DevOps中的更改

In DevOps I cloned my existing Visual Studio Build stage (called 'Build Winforms solution') and renamed the clone to Build Databases: 在DevOps中,我克隆了现有的Visual Studio Build阶段(称为“ Build Winforms解决方案”),并将克隆重命名为Build Databases:

在此处输入图片说明

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: 我在“变量”选项卡中添加了两个新的构建变量,名为ClickOnceBuildStageConfiguration和DatabasesBuildStageConfiguration,其值设置为我们刚刚在VS中创建的新配置的名称:

在此处输入图片说明

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: 然后,我更改了WinForms构建阶段,以使用新的ClickOnceBuildStageConfiguration变量-请注意,我们仍然具有/T:"VisionShellWin" /target:Publish设置ClickOnce所需的MSBuild参数:

在此处输入图片说明

And the new Build Databases stage to use the databases variable - note that we don't have any MSBuild Arguments: 在新的构建数据库阶段使用数据库变量-请注意,我们没有任何MSBuild参数: 在此处输入图片说明

Finally, in addition to the copy stage I already had for copying the ClickOnce application files into the drop artifact: 最后,除了复制阶段外,我还具有将ClickOnce应用程序文件复制到drop工件中的功能:

在此处输入图片说明

I also added a Copy Files stage (called 'Copy Dacpacs') to copy the DacPac into the drop too: 我还添加了一个“复制文件”阶段(称为“复制Dacpacs”),也将DacPac复制到放置中:

在此处输入图片说明

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 完成所有这些操作之后,您应该以可以正常工作的构建和包含ClickOnce文件和DacPacs的构件为最终结果

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Team Foundation Service将SQL数据库连续交付到Windows Azure - Continuous delivery of SQL Database to Windows Azure by using Team Foundation Service 持续部署和交付 - Continuous deployment & delivery 与TFS集成的持续交付管道 - Continuous Delivery pipeline integrated with TFS 如何避免 CI 中的 .dacpac 项目检查? - How to avoid .dacpac project checks in CI? 连续交付的远程调试-故障定位依赖 - Remote Debugging with Continuous Delivery - failure locating dependency 持续交付工具或框架中的SQL脚本 - SQL Scripts in Continuous Delivery tool or framework VS403250:dacpac 或源数据库不是分离的 TFS 集合数据库 - VS403250: The dacpac or source database is not a detached TFS Collection database 为什么不出现“配置连续交付”选项? - Why won't the “Configure Continuous Delivery” option appear? 是否有内置的方法来设置对专用(非天蓝色)服务器的持续交付? - Is there a built in way to setup continuous delivery to a dedicated (NOT AZURE) server? 如何在 Azure DevOps 持续部署中从我的数据库中自动更新我的项目的模型? - How to automate a models update of my project from my database in a Azure DevOps continuous deployment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM