Solution not found using search pattern 'D:\a\1\s\**\*.sln' Azure Devops - azure-devops

I am getting this error of Solution not found using search pattern 'D:\a\1\s***.sln' while building and deploying dacpac via yaml file.
My yaml file is below.
trigger:
- master
pool:
name: Azure Pipelines
vmImage: 'vs2017-win2016'
jobs:
- deployment: BuildAndDeploy
displayName: Build And Deploy Dacpac
environment: 'DEV'
strategy:
runOnce:
deploy:
steps:
- task: VSBuild#1
displayName: 'Build solution **\*.sln'
- task: CopyFiles#2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(agent.builddirectory)'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: AzureKeyVault#1
displayName: 'Azure Key Vault: kv-agaurav-poc'
inputs:
azureSubscription: 'Visual Studio Enterprise-abonnement (b5970491-02a8-4fd0-b9b4-73a6e63a273a)'
KeyVaultName: 'kv-agaurav-poc'
RunAsPreJob: true
- task: SqlAzureDacpacDeployment#1
displayName: 'Azure SQL DacpacTask'
inputs:
azureSubscription: 'Visual Studio Enterprise-abonnement (b5970491-02a8-4fd0-b9b4-73a6e63a273a)'
ServerName: 'fastbin-server.database.windows.net'
DatabaseName: 'fastbin-db'
SqlUsername: agaurav
SqlPassword: '$(sqlpassword)'
DacpacFile: 'D:\a\1\a\s\bin\Debug\fastbin-db.dacpac'
One thing to note is that if I have the steps and tasks outside the environment, it works.
So, my question is how can I make yaml file find the solution inside any environment tags (In this case environment: 'DEV').

deployment job doesn't checkout you code by default. You need to add - checkout: self to download code first before you try to build you solution.

Related

how do I debug a failed multi-stage Azure DevOps pipeline that fails to run a stage and produces no errors?

I have a multi-stage Azure DevOps YAML pipeline that had been running fine up until I included a block of parameters (in the part of YAML before the first stage). Now, with these parameters, the Build stage continues to run. But the Release stage does nothing. It doesn't produce an error, it just doesn't run. I'm left with a message:
"Parent pipeline used these runtime parameters"
And then there is is a collapsible UI element you can expand to see the parameters, which isn't super helpful, given that I know what the parameters were.
The parameter block that is now making my multi-stage YAML pipeline fail without any helpful errors is this:
parameters:
- name: configuration
type: object
default:
- Texas
- Arizona
Is it even possible to make a multi-stage YAML AzureDevOps pipeline that accepts parameters? Or is that the limitation (seemingly undocumented) that I am running up against?
EDIT: Here's the whole YAML:
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
# Gus' first working multi-stage pipeline
trigger: none
pool:
#windows-latest worked until Microsoft cnaged it to windows-2022 and i got
#"The reference assemblies for .NETFramework,Version=v4.6.1 were not found." error
vmImage: 'windows-2019'
parameters:
- name: configuration
type: object
default:
- Texas
- Arizona
variables:
- name: solution
value: '**/*.sln'
- name: buildPlatform
value: 'Any CPU'
- name: buildConfiguration
value: "Texas"
stages:
- stage: build
displayName: Build
jobs:
- job: Build
steps:
- ${{ each configuration in parameters.configuration }}:
- script: 'echo ${{ configuration }}'
- checkout: self
- task: CmdLine#2
inputs:
script: |
cd $(build.sourcesdirectory)
#without this first one, bad things happen!!
- task: NuGetCommand#2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
- task: NuGetToolInstaller#1
- task: VSBuild#1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest#2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- stage: Release
displayName: Release
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
jobs:
- deployment:
displayName: Release
environment:
name: QA
resourceType: VirtualMachine
strategy:
runOnce:
deploy:
steps:
#- script: echo building $(Build.BuildNumber) with ${{ parameters.configuration }}
- task: CopyFiles#2
inputs:
SourceFolder: '$(Agent.WorkFolder)\1\drop'
Contents: '**\*.zip'
OverWrite: true
TargetFolder: 'C:\QA\Web Sites\${buildConfiguration}'

How to use Azure DevOps Pipelines Machine File Copy Using Environments?

I need to move files from ADO to a VM. This VM is set up using "Environments" and tagged appropriately. I would like to copy those files to that VM using its environment name and tag. So far I've only found "Windows machine file copy" which requires storing a admin login. Is there a way to use the Environments instead of hardcoding a login?
You can set up the YAML pipeline like as below:
If you want to copy the build artifact files to the VM, reference below sample.
In the Build stage set up the jobs to build the source code, and publish the artifact files for use.
In the Deploy stage, when setting the deployment job with an environment on an VM, all steps in this job will be run on this VM. In the deployment job, at the very first step, it will automatically download the artifact files to the working directory on the VM.
Then you can use the CopyFiles task to the copy the artifact files to any accessible directory on the VM.
stages:
- stage: Build
displayName: 'Build'
. . .
- stage: Deploy
displayName: 'Deploy'
dependsOn: Build
condition: succeeded()
jobs:
- deployment: Deployment
displayName: 'Deployment'
environment: '{EnvironmentName.ResourceName}'
strategy:
runOnce:
deploy:
steps:
- task: CopyFiles#2
displayName: 'Copy Files to: {Destination Directory}'
inputs:
SourceFolder: '$(Pipeline.Workspace)/drop'
Contents: '**'
TargetFolder: '{Destination Directory}'
CleanTargetFolder: true
If the files you want to copy the VM are the source files in the repository, reference below sample.
stages:
- stage: Deploy
displayName: 'Deploy'
dependsOn: Build
condition: succeeded()
jobs:
- deployment: Deployment
displayName: 'Deployment'
environment: '{EnvironmentName.ResourceName}'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: CopyFiles#2
displayName: 'Copy Files to: {Destination Directory}'
inputs:
SourceFolder: '$(Pipeline.Workspace)'
Contents: '**'
TargetFolder: '{Destination Directory}'
CleanTargetFolder: true
For more details, you can see: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/environments-kubernetes?view=azure-devops
I have been struggling for a while with setting up an Azure Pipeline to deploy .Net Core service to VM. I had the following requirements:
to use YAML files instead of classic UI
to deploy as a windows service not to IIS
to use stages in pipeline
I was using monorepo with the service residing in MyService folder
In addition I had an external NuGet feed
My solution consisted of several projects and I was building only one of them
appsettings.release.json was being replaced with the one persisted on the server to preserve settings
I was inspired by Bright Ran-MSFT answer and suggest my complete azure-pipelines.yml file
trigger:
branches:
include:
- staging
paths:
include:
- MyService
pool:
vmImage: "windows-latest"
variables:
solution: "MyService/MyService.sln"
buildPlatform: "Any CPU"
buildConfiguration: "Release"
stages:
- stage: Build
jobs:
- job: BuildJob
steps:
- task: NuGetCommand#2
inputs:
restoreSolution: "$(solution)"
feedsToUse: "config"
nugetConfigPath: "MyService/NuGet.Config"
- task: VSBuild#1
inputs:
solution: "$(solution)"
msbuildArgs: '/t:MyService:Rebuild /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:OutDir="$(build.artifactStagingDirectory)\service_package"'
platform: "$(buildPlatform)"
configuration: "$(buildConfiguration)"
- task: VSTest#2
inputs:
platform: "$(buildPlatform)"
configuration: "$(buildConfiguration)"
- task: PublishPipelineArtifact#1
inputs:
targetPath: '$(build.artifactStagingDirectory)\service_package'
artifactName: "service_package"
- stage: Deploy
displayName: 'Deploy'
dependsOn: Build
condition: succeeded()
jobs:
- deployment: Deployment
displayName: 'Deployment'
environment: 'MainDeployEnv.MY_VM_SERVER'
strategy:
runOnce:
deploy:
steps:
- task: CopyFiles#2
displayName: 'Copy Package to: C:\azservices\MyService\service'
inputs:
SourceFolder: '$(Pipeline.Workspace)/service_package'
Contents: '**'
TargetFolder: 'C:\azservices\MyService\service\'
CleanTargetFolder: true
- task: CopyFiles#2
displayName: 'Replace appsettings.release.json'
inputs:
SourceFolder: 'C:\azservices\MyService\settings'
Contents: 'appsettings.release.json'
TargetFolder: 'C:\azservices\MyService\service\'
OverWrite: true

Azure DevOps Pipeline forever stuck in Pending

We've got an Azure DevOps Pipeline running on a self-hosted against without parallelism that is not running it's Deployment Job or Step.
The version I'm posting below will have two stages, but note that I have tried this by removing the second stage and converting the entire stage to a job, and still the same result. I should also note that I've got multiple pipelines with multiple jobs that run just fine, it seems to be an issue with the specific deployment job.
The second stage is forever stuck in Pending ("Job is Pending"). It will never proceed to start running.
The stage can also not be cancelled, and per the image above, it's been stuck for 2 months.
I should also note that I have submitted this to the Azure Developer Community at developercommunity.visualstudio.com, but I think they've abandoned my ticket.
I'm sure that there are many successful CI/CD deployments in Azure DevOps, I just can't tell what I'm doing wrong here. I am utilizing a working method in our separate Release Pipelines that we are running manually.
Below is the affected pipeline, any guidance would be greatly appreciated.
trigger: none
variables:
ArtifactPackageName: 'app.zip'
DeploySite.IISDeploymentType: 'IISWebsite'
DeploySite.ActionIISWebsite: 'CreateOrUpdateWebsite'
DeploySite.WebsiteName: 'REDACTED'
DeploySite.WebsitePhysicalPath: '%SystemDrive%\inetpub\wwwroot\REDACTED'
DeploySite.AddBinding: false
DeploySite.VirtualPathForApplication: '/REDACTED'
DeploySite.AppPoolName: 'REDACTED'
DeploySite.VirtualApplication: 'REDACTED'
DeploySite.Package: $(Pipeline.Workspace)/drop/$(ArtifactPackageName)
DeploySite.RemoveAdditionalFilesFlag: true
DeploySite.TakeAppOfflineFlag: true
DeploySite.XmlTransformation: false
DeploySite.XmlVariableSubstitution: true
DeploySite.SetParametersFile: $(Pipeline.Workspace)/drop/REDACTED.SetParameters.xml
DeploySite.JSONSettingsFiles: '**/appsettings.json'
stages:
- stage: 'Build'
displayName: 'Build'
jobs:
- job: 'Build'
displayName: 'Build'
pool:
name: REDACTED
variables:
Solution: '**/*.sln'
BuildPlatform: 'Any CPU'
BuildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller#1
displayName: 'Install NuGet Tools'
- task: NuGetCommand#2
displayName: 'Restore NuGet Packages'
inputs:
restoreSolution: '$(Solution)'
- task: VSBuild#1
displayName: 'MSBuild'
inputs:
solution: '$(Solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(Build.ArtifactStagingDirectory)\$(ArtifactPackageName)"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PublishBuildArtifacts#1
displayName: 'Publish Build Artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: drop
publishLocation: 'Container'
- stage: 'Deploy'
displayName: 'Deploy'
dependsOn: 'Build'
jobs:
- deployment: 'Deploy'
displayName: 'Deploy'
continueOnError: false
timeoutInMinutes: 10
workspace:
clean: all
pool:
name: REDACTED
environment:
name: SERVER-DEV
resourceType: VirtualMachine
strategy:
runOnce:
deploy:
steps:
- download: current
displayName: 'Download Artifact'
artifact: drop
- task: IISWebAppManagementOnMachineGroup#0
displayName: 'Stop IIS App Pool'
continueOnError: false
inputs:
IISDeploymentType: IISApplicationPool
ActionIISApplicationPool: StopAppPool
StartStopRecycleAppPoolName: '$(Parameters.WebsiteName)'
- task: IISWebAppDeploymentOnMachineGroup#0
displayName: 'IIS Web App Deploy'
continueOnError: false
inputs:
WebSiteName: '$(DeploySite.WebsiteName)'
VirtualApplication: '$(DeploySite.VirtualApplication)'
Package: '$(DeploySite.Package)'
RemoveAdditionalFilesFlag: $(DeploySite.RemoveAdditionalFilesFlag)
SetParametersFile: $(DeploySite.SetParametersFile)
TakeAppOfflineFlag: $(DeploySite.TakeAppOfflineFlag)
XmlTransformation: $(DeploySite.XmlTransformation)
XmlVariableSubstitution: $(DeploySite.XmlVariableSubstitution)
JSONFiles: $(DeploySite.JSONSettingsFiles)
- task: IISWebAppManagementOnMachineGroup#0
displayName: 'Start IIS App Pool'
continueOnError: true
inputs:
IISDeploymentType: IISApplicationPool
ActionIISApplicationPool: StartAppPool
StartStopRecycleAppPoolName: '$(Parameters.WebsiteName)'
I had the same error.
I renamed - deployment: Deploy to - deployment: Deployment
...and it started to work.
Changed
from - deployment: Deploy To - deployment: Deployment
I was facing the same error on a stage with only a Deployment job.
A successful workaround is to replace the Deployment job with a regular Job. However, this approach won't keep your deployment history or allow a deployment strategy.
In your case, the Deploy would be:
- stage: 'Deploy'
displayName: 'Deploy'
dependsOn: 'Build'
jobs:
- job: 'Deploy'
displayName: 'Deploy'
continueOnError: false
timeoutInMinutes: 10
workspace:
clean: all
pool:
name: REDACTED
steps:
- download: current
displayName: 'Download Artifact'
artifact: drop
- task: IISWebAppManagementOnMachineGroup#0
displayName: 'Stop IIS App Pool'
continueOnError: false
inputs:
IISDeploymentType: IISApplicationPool
ActionIISApplicationPool: StopAppPool
StartStopRecycleAppPoolName: '$(Parameters.WebsiteName)'
- task: IISWebAppDeploymentOnMachineGroup#0
displayName: 'IIS Web App Deploy'
continueOnError: false
inputs:
WebSiteName: '$(DeploySite.WebsiteName)'
VirtualApplication: '$(DeploySite.VirtualApplication)'
Package: '$(DeploySite.Package)'
RemoveAdditionalFilesFlag: $(DeploySite.RemoveAdditionalFilesFlag)
SetParametersFile: $(DeploySite.SetParametersFile)
TakeAppOfflineFlag: $(DeploySite.TakeAppOfflineFlag)
XmlTransformation: $(DeploySite.XmlTransformation)
XmlVariableSubstitution: $(DeploySite.XmlVariableSubstitution)
JSONFiles: $(DeploySite.JSONSettingsFiles)
- task: IISWebAppManagementOnMachineGroup#0
displayName: 'Start IIS App Pool'
continueOnError: true
inputs:
IISDeploymentType: IISApplicationPool
ActionIISApplicationPool: StartAppPool
StartStopRecycleAppPoolName: '$(Parameters.WebsiteName)'

Why are the Changes and Workitems pages empty under an Environment in a multi-stage Azure Devops pipline?

I created a yaml-based, multi-stage pipeline in Azure DevOps.
variables:
versionPrefix: '7.1.0.'
versionRevision: $[counter(variables['versionPrefix'], 100)]
version: $[format('{0}{1}',variables['versionPrefix'],variables['versionRevision'])]
solution: '**/product.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
name: $(version)_$(Date:yyyyMMdd)$(Rev:.r)
stages:
- stage: Build
pool: Default
jobs:
- job: Build
displayName: Build
steps:
- task: NuGetToolInstaller#1
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'
- task: VersionAssemblies#2
displayName: Version Assemblies
inputs:
Path: '$(Build.SourcesDirectory)'
VersionNumber: '$(version)'
InjectVersion: true
FilenamePattern: 'AssemblyInfo.*'
OutputVersion: 'OutputedVersion'
- task: VSBuild#1
displayName: Build product
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
maximumCpuCount: true
- stage: Deploy
dependsOn: Build
pool: Default
jobs:
- deployment: Deployment
displayName: DeployA
environment: 7-1-0
strategy:
runOnce:
deploy:
steps:
- task: PowerShell#2
inputs:
targetType: 'inline'
script: |
Write-Host "Deployed"
As shown above, the pipeline includes a deployment stage that references an environment named '7-1-0'. After the pipeline runs, a deployment is displayed in the UI for that environment. However, under that environment both the Changes and Workitems pages are empty. I confirmed there are new changes that have not previously been deployed to this environment. Why?
Note the deployment stage doesn't actually do anything. We're doing the actual deployment manually, but were hoping to track the changes to the environment via DevOps. Also, we haven't defined any resources for the environment. I couldn't find anything stating it was required to have a resource defined for traceability of commits and work items.
UPDATE 1
Per #Leo-Liu-MSFT suggestion below, I updated the pipeline to publish an artifact. Note that the build runs on a self-hosted agent. However, I'm still not getting any results in Environment Changes and Workitems.
variables:
versionPrefix: '7.1.0.'
versionRevision: $[counter(variables['versionPrefix'], 100)]
version: $[format('{0}{1}',variables['versionPrefix'],variables['versionRevision'])]
solution: '**/product.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
name: $(version)_$(Date:yyyyMMdd)$(Rev:.r)
stages:
- stage: Build
pool: Default
jobs:
- job: Build
displayName: Build
steps:
- task: NuGetToolInstaller#1
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'
- task: VersionAssemblies#2
displayName: Version Assemblies
inputs:
Path: '$(Build.SourcesDirectory)'
VersionNumber: '$(version)'
InjectVersion: true
FilenamePattern: 'AssemblyInfo.*'
OutputVersion: 'OutputedVersion'
- task: VSBuild#1
displayName: Build product
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
maximumCpuCount: true
- task: PowerShell#2
inputs:
targetType: 'inline'
script: |
New-Item -Path '$(build.artifactstagingdirectory)' -Name "testfile1.txt" -ItemType "file" -Value "Hello, DevOps!" -force
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'FilePath'
TargetPath: 'C:\a\p\\$(Build.DefinitionName)\\$(Build.BuildNumber)'
- stage: Deploy
dependsOn: Build
pool: Default
jobs:
- deployment: Deployment
displayName: DeployA
environment: 7-1-0
strategy:
runOnce:
deploy:
steps:
- task: PowerShell#2
inputs:
targetType: 'inline'
script: |
Write-Host "Deployed"
UPDATE 2
Per follow up suggestion from #Leo-Liu-MSFT, I created the following attempted publishing the artifact to Azure. I also simplified the yaml to use a Microsoft Hosted Agent. Note I did have the issue described here which is why I configured the deployment task they way I did with 'download: none'. I'm still not getting any Changes or Workitems in the environment.
variables:
ArtifactName: drop
stages:
- stage: Build
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: CopyFiles#2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/Build'
targetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
ArtifactName: $(ArtifactName)
- stage: Deploy
dependsOn: Build
pool:
vmImage: ubuntu-latest
jobs:
- deployment: Deployment
displayName: DeployA
environment: 7-1-0
strategy:
runOnce:
deploy:
steps:
- download: none
- task: DownloadBuildArtifacts#0
inputs:
artifactName: $(ArtifactName)
buildType: 'current'
downloadType: 'single'
downloadPath: '$(System.ArtifactsDirectory)'
FINAL UPDATE
Here's the working YAML. The final trick was to set download to current and specify the artifact name.
variables:
ArtifactName: drop
stages:
- stage: Build
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: CopyFiles#2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/Build'
targetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
ArtifactName: $(ArtifactName)
- stage: Deploy
dependsOn: Build
pool:
vmImage: ubuntu-latest
jobs:
- deployment: Deployment
displayName: DeployA
environment: 7-1-0
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: $(ArtifactName)
Why are the Changes and Workitems pages empty under an Environment in a multi-stage Azure Devops pipline?
You need to add publish build Artifacts task to publish build artifacts to Azure Pipelines.
Azure devops track the changes and workitems via REST API, then Azure devops passes this information to other environments by transferring files.
So, we need to publish the artifact to the Azure Pipelines so that the deploy stage could get those info when it is getting source.
As test, I just add the copy task and publish build artifact task in the build stage, like:
stages:
- stage: Build
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: CopyFiles#2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
targetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
- stage: Deploy
dependsOn: Build
pool:
vmImage: ubuntu-latest
jobs:
- deployment: Deployment
displayName: DeployA
environment: 7-1-0
strategy:
runOnce:
deploy:
steps:
- task: PowerShell#2
inputs:
targetType: 'inline'
script: |
Write-Host "Deployed"
The result:
Update:
I had to make a few updates to deal with an issue downloading the
artifact. Still not getting any Changes or Workitems on the
environment. I do appreciate your help!
That because you are disable the built-in download task instead of using DownloadBuildArtifacts task, which task do not have feature to fetch the commits and work items.
- download: none
You need delete above in your YAML. As I test your updated YAML without - download: none, it works fine.
Hope this helps.

Error deploying with devops multi staging pipelines

I am using azure devops multi staging pipelines and have the following YAML file. I can create a build and then publish the build artifact to drop. When I try to deploy, I get an error seen below.
I have tried many things but I want my deployment to be in the same pipeline as I know you can add it to the release pipeline. Am I missing something?
stages:
- stage: Build
jobs:
- job: Build
pool:
name: Hosted Windows 2019 with VS2019
demands: azureps
steps:
# Restore
- task: DotNetCoreCLI#2
displayName: Restore
inputs:
command: restore
projects: '**/*.csproj'
feedsToUse: select
vstsFeed : myfeed
includeNuGetOrg : true
# Build
- task: DotNetCoreCLI#2
displayName: Build
inputs:
command: build
projects: '**/*.csproj'
arguments: '--configuration Release'
# Publish
- task: DotNetCoreCLI#2
displayName: Publish
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
# Publish Artifact
- task: PublishBuildArtifacts#1
- stage: Dev
jobs:
# track deployments on the environment
- deployment: DeployWeb
pool:
vmImage: 'ubuntu-latest'
# creates an environment if it doesn’t exist
environment: 'my-dev'
strategy:
# default deployment strategy
runOnce:
deploy:
steps:
- task: DownloadBuildArtifacts#0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'drop'
downloadPath: '$(build.ArtifactStagingDirectory)'
- task: AzureWebApp#1
displayName: Azure Web App Deploy
inputs:
appType: 'webapp'
azureSubscription: '213456123'
appName: mytestapp
package:$(System.DefaultWorkingDirectory)/**/*.zip
Error I am getting
The artifact has been downloaded to artifact folder $(build.ArtifactStagingDirectory), so the package path could be: package:$(build.ArtifactStagingDirectory)/**/*.zip
In my case, I simply copied artifact download path from DownloadBuildArtifacts#0 task after its implementation and pasted it in AzureWebApp#1 task's package property.
Yes, it required me to run a single fail so that I can find exact path where artifacts are downloaded. Can simply run DownloadBuildArtifacts#0 task only so that you can find exact download path of artifacts.