如何在 Azure CI 构建管道中创建工作 VHDX?
How to create a working VHDX in Azure CI Build Pipeline?
此问题与Azure MSIX Build and Package task only has Release and Debug configurations
相关
我们有一个包含 MSIX 安装程序的 WinForms 项目。手动,我们可以成功创建
- 一个 MSIXBUNDLE 并将其部署到 Kudu
- MSIX 并通过 VHDX 将其部署到 Azure VM。我们先手动将 MSIX 转换为 VHDX
我们现在正在尝试自动化构建和发布过程以创建 VHDX。但是,当使用我们已经验证的过程安装 VHDX 时,我们会看到一个空白屏幕。唯一不同的是构建方法(即 MSBuild 与 VS Publish)。
我们如何在 Azure 中创建工作 VHDX CI 构建管道?
下面是 YAML。
pool:
vmImage: windows-2019
variables:
- name: solution
value: 'ProjectName.sln'
- name: buildPlatform
value: 'x64'
- name: buildConfiguration
value: 'development'
- name: major
value: 1
- name: minor
value: 0
- name: build
value: 0
- name: revision
value: $[counter('rev', 0)]
- name: vhdxSize
value: '200'
- group: 'legacy-pipeline'
- name: signingCertPwd
value: $[variables.SigningCertPassword]
steps:
- powershell: |
# Update appxmanifest. This must be done before the build.
[xml]$manifest= get-content ".\ProjectName.MsixInstaller\Package.appxmanifest"
$manifest.Package.Identity.Version = "$(major).$(minor).$(build).$(revision)"
$manifest.save("ProjectName.MsixInstaller/Package.appxmanifest")
displayName: 'Version Package Manifest'
- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.9.1'
checkLatest: true
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: $(solution)
feedsToUse: 'select'
- task: MSBuild@1
inputs:
solution: ProjectName.MsixInstaller/ProjectName.MsixInstaller.wapproj
platform: $(buildPlatform)
configuration: $(buildConfiguration)
msbuildArguments: '/p:OutputPath=NonPackagedApp
/p:UapAppxPackageBuildMode=SideLoadOnly /p:AppxBundle=Never /p:AppxPackageOutput=$(Build.ArtifactStagingDirectory)\ProjectName.msix /p:AppxPackageSigningEnabled=false'
displayName: 'Package the App'
- task: MsixSigning@1
inputs:
package: '$(Build.ArtifactStagingDirectory)\**\*.msix*'
certificate: 'Accumatch.DeveloperCodeSigningCert_TemporaryKey.pfx'
passwordVariable: signingCertPwd
- task: AppInstallerFile@1
inputs:
package: '$(Build.ArtifactStagingDirectory)\ProjectName.msix'
outputPath: '$(Build.ArtifactStagingDirectory)\ProjectName.appinstaller'
method: 'create'
fileVersion: '1.0.0.0'
uri: 'https://ProjectNamedemo.azurewebsites.net/ProjectName.appinstaller'
mainItemUri: 'https://ProjectNamedemo.azurewebsites.net/ProjectName.msix'
showPromptWhenUpdating: true
updateBlocksActivation: true
- task: MsixAppAttach@1
inputs:
package: '$(Build.ArtifactStagingDirectory)\ProjectName.msix'
vhdxOutputPath: '$(Build.ArtifactStagingDirectory)\ProjectName.vhdx'
vhdxSize: $(vhdxSize)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
其实YAML并没有什么问题。问题是虚拟机加载 VHDX 时出现延迟。换句话说,在安装 VHDX 后等待大约 5 分钟,然后再尝试 运行 应用程序。我把它留在这里以防其他人 运行 进入这个 issue
.
此问题与Azure MSIX Build and Package task only has Release and Debug configurations
相关我们有一个包含 MSIX 安装程序的 WinForms 项目。手动,我们可以成功创建
- 一个 MSIXBUNDLE 并将其部署到 Kudu
- MSIX 并通过 VHDX 将其部署到 Azure VM。我们先手动将 MSIX 转换为 VHDX
我们现在正在尝试自动化构建和发布过程以创建 VHDX。但是,当使用我们已经验证的过程安装 VHDX 时,我们会看到一个空白屏幕。唯一不同的是构建方法(即 MSBuild 与 VS Publish)。
我们如何在 Azure 中创建工作 VHDX CI 构建管道?
下面是 YAML。
pool:
vmImage: windows-2019
variables:
- name: solution
value: 'ProjectName.sln'
- name: buildPlatform
value: 'x64'
- name: buildConfiguration
value: 'development'
- name: major
value: 1
- name: minor
value: 0
- name: build
value: 0
- name: revision
value: $[counter('rev', 0)]
- name: vhdxSize
value: '200'
- group: 'legacy-pipeline'
- name: signingCertPwd
value: $[variables.SigningCertPassword]
steps:
- powershell: |
# Update appxmanifest. This must be done before the build.
[xml]$manifest= get-content ".\ProjectName.MsixInstaller\Package.appxmanifest"
$manifest.Package.Identity.Version = "$(major).$(minor).$(build).$(revision)"
$manifest.save("ProjectName.MsixInstaller/Package.appxmanifest")
displayName: 'Version Package Manifest'
- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.9.1'
checkLatest: true
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: $(solution)
feedsToUse: 'select'
- task: MSBuild@1
inputs:
solution: ProjectName.MsixInstaller/ProjectName.MsixInstaller.wapproj
platform: $(buildPlatform)
configuration: $(buildConfiguration)
msbuildArguments: '/p:OutputPath=NonPackagedApp
/p:UapAppxPackageBuildMode=SideLoadOnly /p:AppxBundle=Never /p:AppxPackageOutput=$(Build.ArtifactStagingDirectory)\ProjectName.msix /p:AppxPackageSigningEnabled=false'
displayName: 'Package the App'
- task: MsixSigning@1
inputs:
package: '$(Build.ArtifactStagingDirectory)\**\*.msix*'
certificate: 'Accumatch.DeveloperCodeSigningCert_TemporaryKey.pfx'
passwordVariable: signingCertPwd
- task: AppInstallerFile@1
inputs:
package: '$(Build.ArtifactStagingDirectory)\ProjectName.msix'
outputPath: '$(Build.ArtifactStagingDirectory)\ProjectName.appinstaller'
method: 'create'
fileVersion: '1.0.0.0'
uri: 'https://ProjectNamedemo.azurewebsites.net/ProjectName.appinstaller'
mainItemUri: 'https://ProjectNamedemo.azurewebsites.net/ProjectName.msix'
showPromptWhenUpdating: true
updateBlocksActivation: true
- task: MsixAppAttach@1
inputs:
package: '$(Build.ArtifactStagingDirectory)\ProjectName.msix'
vhdxOutputPath: '$(Build.ArtifactStagingDirectory)\ProjectName.vhdx'
vhdxSize: $(vhdxSize)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
其实YAML并没有什么问题。问题是虚拟机加载 VHDX 时出现延迟。换句话说,在安装 VHDX 后等待大约 5 分钟,然后再尝试 运行 应用程序。我把它留在这里以防其他人 运行 进入这个 issue
.