I want to set up CI/CD for a Blazor web client application project to copy the contents to an Azure blob storage. Below are the CI tasks
- task: VSBuild@1
displayName: 'Build MyBlazor Web'
inputs:
solution: ./MyBlazorWeb/MyBlazorWeb.sln
vsVersion: 16.0
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
configuration: Release
restoreNugetPackages: true
- task: DotNetCoreCLI@2
displayName: 'Publishing MyBlazor Web...'
inputs:
command: publish
publishWebProjects: true
projects: ./MyBlazorWeb/MyBlazorWeb/MyBlazorWeb.csproj
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/drop/MyBlazorWeb'
artifactName: MyBlazor
zipAfterPublish: false
- publish: $(Build.ArtifactStagingDirectory)
artifact: drop
Below is my CD task
- task: AzureFileCopy@2
displayName: 'Copy MyBlazorWeb to Static Web Site'
inputs:
SourcePath: '$(build.artifactStagingDirectory)/drop/MyBlazorWeb'
azureSubscription: '$(subscription)'
Destination: AzureBlob
storage: '$(storage-account-name)'
ContainerName: '$web'
The AZCopy throws the below error
Error parsing source location "D:\a\1\a\drop\MyBlazorWeb": Failed to enumerate directory D:\a\1\a\drop\MyBlazorWeb\ with file pattern *. The system cannot find the path specified. (Exception from HRESULT: 0x80070003) For more details, please type "AzCopy /?:Source" or use verbose option /V.
Am I missing any additional tasks or not using the correct source path? If those tasks/steps are not correct, how can I host Blazor webassembly in Azure storage?
You can specify the System.ArtifactsDirectory
variable in the SourcePath
parameter of the AzureFileCopy task.
- task: AzureFileCopy@2
displayName: 'Copy MyBlazorWeb to Static Web Site'
inputs:
SourcePath: '$(System.ArtifactsDirectory)/drop/MyBlazorWeb'
azureSubscription: '$(subscription)'
Destination: AzureBlob
storage: '$(storage-account-name)'
ContainerName: '$web'
System.ArtifactsDirectory
: The directory to which artifacts are downloaded during deployment of a release. The directory is cleared before every deployment if it requires artifacts to be downloaded to the agent. Same as Agent.ReleaseDirectory and System.DefaultWorkingDirectory.
Example: C:\agent\_work\r1\a
Build.ArtifactStagingDirectory
is agent-scoped variable, so you can not use it in release pipeline.
User contributions licensed under CC BY-SA 3.0