简体   繁体   中英

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. 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?

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 .

@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:

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.

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM