This question is related to Azure MSIX Build and Package task only has Release and Debug configurations
We have a WinForms project that has an MSIX installer. Manually, we can successfully create
We are now trying to automate the build and release process to create the VHDX. However, we are getting a blank screen when the VHDX is mounted using a process that we have already validated. The only thing different is the build method (i.e., MSBuild versus VS Publish).
How do we create a working VHDX in Azure CI Build Pipeline?
Below is the 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'
Actually, there is nothing wrong with the YAML. The problem was a delay in the virtual machine loading the VHDX. In other words, wait about 5 minutes once the VHDX is mounted before trying to run the application. I am leaving this here in case anyone else runs into this issue
.