Last active
December 17, 2019 12:12
-
-
Save giacomelli/30d0b7c0a3e803cb71ce4b1680d2a584 to your computer and use it in GitHub Desktop.
Azure Pipelines - Generating DB Script with SqlPackage.exe: http://diegogiacomelli.com.br/azure-pipelines-generating-db-script/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool: | |
vmImage: 'vs2017-win2016' | |
variables: | |
buildPlatform: 'Any CPU' | |
buildConfiguration: 'Release' | |
dbProject: 'Set with the name of your Sql Server Database Project' | |
targetDBConnectionString: 'Set with the connection string of the target database' | |
- task: VSBuild@1 | |
displayName: 'DB: build project' | |
inputs: | |
solution: 'src\$(dbProject)\$(dbProject).sln' | |
platform: '$(buildPlatform)' | |
configuration: '$(buildConfiguration)' | |
- task: CmdLine@2 | |
displayName: 'DB: script generation' | |
inputs: | |
script: | | |
"c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\sqlpackage.exe" ^ | |
/action:script ^ | |
/sourcefile:src\$(dbProject)\bin\$(buildConfiguration)\$(dbProject).dacpac ^ | |
/outputpath:db-script.sql ^ | |
/TargetConnectionString:"$(targetDBConnectionString)" | |
- task: PublishBuildArtifacts@1 | |
displayName: 'DB: publish script' | |
inputs: | |
pathtoPublish: '$(Build.SourcesDirectory)\db-script.sql' | |
publishLocation: 'Container' | |
ArtifactName: 'db-script.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- task: CmdLine@2 | |
displayName: 'DB: script generation' | |
inputs: | |
script: | | |
"c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\sqlpackage.exe" ^ | |
/action:script ^ | |
/sourcefile:src\$(dbProject)\bin\$(buildConfiguration)\$(dbProject).dacpac ^ | |
/outputpath:db-script.sql ^ | |
/TargetConnectionString:"$(targetDBConnectionsTring)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- task: PublishBuildArtifacts@1 | |
displayName: 'DB: publish script' | |
inputs: | |
pathtoPublish: '$(Build.SourcesDirectory)\db-script.sql' | |
publishLocation: 'Container' | |
ArtifactName: 'db-script.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool: | |
vmImage: 'vs2017-win2016' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- task: VSBuild@1 | |
displayName: 'DB: build project' | |
inputs: | |
solution: 'src\$(dbProject)\$(dbProject).sln' | |
platform: '$(buildPlatform)' | |
configuration: '$(buildConfiguration)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment