- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过 IIS 网站和 SQL 部署在 Azure DevOps 中部署我的项目。但是,我正在努力部署 SQL 部分,因为我的构建工件中没有 .dacpac 文件。我如何生成它,因为我尝试过的任何选项都以过程失败而告终。
附言由于限制,我无权访问我正在部署的 VM。我可以访问数据库,因为我在机器上标记为 DBO。
我的问题也是,我是否需要每次都通过构建生成这个 DACPAC 文件,或者它只能生成一次,存储在机器上,我从部署过程指向该文件?
感谢您的帮助!
最佳答案
However I am struggling with deploying SQL part as I do not have a .dacpac file in my build artifacts. How do I generate this as any option that I have tried it ended up with failing of the process. I can access database as I marked as DBO on the machine.
首先,您必须通过导入实时数据库的对象,使用 SSDT(或 Azure Data Studio 内部预览版)创建 SQL Server 数据库项目。
然后将数据库项目放入存储库
管道(经典或 yaml)具有构建任务 MSBuild@1。这是一个 YAML 示例。它生成 dacpac
- task: MSBuild@1
displayName: 'Build solution YourDatabase.sln'
inputs:
solution: 'src/YourDatabase.sln'
此任务编译数据库项目并生成 dacpac 文件
- task: CopyFiles@2
displayName: 'Extract DACPACs'
inputs:
CleanTargetFolder: false
SourceFolder: '$(agent.builddirectory)\s\src\YourDatabase\bin\Debug\'
Contents: '*.dacpac'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact'
inputs:
targetPath: '$(build.artifactstagingdirectory)'
artifact: 'drop'
SqlDacpacDeploymentOnMachineGroup@0
完成,但是,这超出了原始问题的范围My question is also, do I need to generate this DACPAC file through build every time or it can be generated only once, stored on machine, and I point from deployment process to that file?
视情况而定。
经典管道将 BUILD 和 RELEASE 阶段分开。在这种情况下,您可以构建一次并在未来的许多版本中重用该 dacpac。
在多阶段 yaml 管道的情况下,每个管道运行都会触发构建和部署阶段,这是很常见的,因为它们仍然属于同一个管道并作为单个单元工作运行。
关于azure-devops - 如何生成 DACPAC 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63992521/
我是一名优秀的程序员,十分优秀!