Issue with Database project (DACPAC) - Continuous delivery

二次信任 提交于 2019-12-11 02:39:01

问题


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/

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

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

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.

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


回答1:


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 .

Create Master and child build definition such that they share common drop .




回答2:


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

Changes in 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. 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:

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

Changes in Azure DevOps

In DevOps I cloned my existing Visual Studio Build stage (called 'Build Winforms solution') and renamed the clone to 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:

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:

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

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

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

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



来源:https://stackoverflow.com/questions/31501489/issue-with-database-project-dacpac-continuous-delivery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!