How to exclude artifact files after web deployment? - azure-devops

We have a build/release pipeline that is finally working correctly, but the developer asked that we exclude the stage config files (Web.Dev.config, Web.Test.config, Web.Prod.config) as well as the artifact archive itself from the site/wwwroot.
As you can see, every time we deployed, these zip files have been getting stored in the site root as well. They aren't harmful but it doesn't look good:
This is the Release App Service Web Deploy YAML:
steps:
- task: AzureRmWebAppDeployment#4
displayName: 'Azure App Service Deploy: project-123'
inputs:
azureSubscription: 'Azure Dev Service Connection'
WebAppName: 'project-123'
packageForLinux: '$(System.DefaultWorkingDirectory)/Project123 Dev Build Artifact/Release'
enableCustomDeployment: true
enableXmlTransform: true
How do we exclude those files after successful deployment?
Kudu dir structure:

Building on #theWinterCoder answer, Unfortunately, there doesn’t appear to be a way to honor the MSDeploySkipRules defined in the csproj file. Instead, files and folders can be skipped by defining the AdditionalArguments parameter of the Azure App Service Deploy (AzureRmWebAppDeployment) task.
Since there doesn’t appear to be any official documentation for the -skip rules, and the MSDeploy.exe documentation that Azure Pipelines references is out-of-date, in 2012, richard-szalay wrote a useful article, “Demystifying MSDeploy skip rules”, which provides a lot of details for anyone requiring additional control.
Brief Explanation:
The dirPath argument represents the Web Deploy Provider to skip a directory whilst the filePath argument is used to skip an individual file.
The dirPath starts at wwwroot.
For ASP.NET Core applications, there’s another wwwroot under wwwroot; as such, the absolutePath in that case would look like this: absolutePath=wwwroot\\somefoldername which would map to D:\home\site\wwwroot\wwwroot\somefoldername
Solution:
Therefore, since I’m skipping files, i set the web deploy provider to filePath, and since we’re not using .NET Core, we set absolutePath to Web.Dev.config. That would map to D:\home\site\wwwroot\Web.Dev.config.
The same thing applies for the zip artifact, however, if we don’t prepend \\ before the wildcard it will fail with following error:
Error: Error: The regular expression '.zip’ is invalid. Error: parsing ".zip" - Quantifier {x,y} following nothing. Error count: 1.
-skip:objectName=filePath,absolutePath=Web.Dev.config
-skip:objectName=filePath,absolutePath=Web.Prod.config
-skip:objectName=filePath,absolutePath=Web.Test.config
-skip:objectName=filePath,absolutePath=\\*.zip
or with regular expression:
-skip:objectName=filePath,absolutePath="Web.Dev.config|Web.Prod.config|Web.Test.config|\\*.zip"
Thats it 😃

You can add an additional arguments line to the yml that will tell it to skip certain files. It will look something like this:
AdditionalArguments: '-skip:objectName=dirPath,absolutePath=wwwroot\\Uploads'
More details can be found in this thread

Related

Unexpected error while passing variable group variables (Azure DevOps) to YAML pipeline

I'm a newbie to both Azure DevOps and Terraform but, I'm trying to deploy a pipeline using a YAML file.
I have tried to run a terraform plan using a YAML file and passing variables (from AZ DevOps) but, I got the following error:
2021-11-24T18:39:46.4604561Z Error: "name" may only contain alphanumeric characters, dash, underscores, parentheses and periods
2021-11-24T18:39:46.4604832Z
2021-11-24T18:39:46.4605940Z on modules/aks/main.tf line 2, in resource "azurerm_resource_group" "aks-resource-group":
2021-11-24T18:39:46.4606436Z 2: name = var.resource_group_name
2021-11-24T18:39:46.4606609Z
2021-11-24T18:39:46.4606722Z
2021-11-24T18:39:46.4606818Z
2021-11-24T18:39:46.4607525Z Error: Error: Subnet: (Name "#{vnet_subnet_name}#" / Virtual Network Name "#{vnet_name}#" / Resource Group "RG-XX-XXXX-XXXXX-001") was not found
2021-11-24T18:39:46.4608006Z
2021-11-24T18:39:46.4608580Z on modules/aks/main.tf line 16, in data "azurerm_subnet" "subnet-project":
2021-11-24T18:39:46.4609335Z 16: data "azurerm_subnet" "subnet-project" {
The 'name' has the following format at the Variable group in the Azure DevOps UI:
RG-XX-XXXX-XXXXX-001
This is the snippet of where I included the replace token at the YAML file:
displayName: 'Replace Secrets'
inputs:
targetFiles: |
variables.tfvars
encoding: 'utf-8'
actionOnMissing: fail
tokenPattern: #{MyVar}#
And this is a sample of the variables I have in a variable group:
variable-group-sample
Also, I replace the terraform.tfvars file with something like this:
resource_group_name = "#{resource_group_name}#"
I have checked the name inserted at the UI several times but I feel the error is pointing to something else I cannot see.
Have anyone experienced something related to this error?
Thank you in advance!
tokenPattern: #{MyVar}#
It is looking for the pattern #{MyVar}# to replace. Not "something contained between #{ and }#, but the actual value #{MyVar}#. I'm guessing it's expecting a regular expression, but I'm not familiar with that task.
So the end result is that your #{token values}# aren't getting replaced.
Assuming you're using https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens, you probably want to specify tokenPrefix: #{ and tokenSuffix: }# instead of using tokenPattern.
Now, having said that...
There is no reason for you to be using token replacement on a tfvars file. You should create different tfvars files for each environment, then pass in a tfvars file via the -var-file argument to Terraform. Secrets can be passed in on the command line via -var 'foo=bar'
Storing variables that represent application or deployment configuration in Azure DevOps (or GitHub, or any other CI system) is a big, big anti-pattern, because it's tightly coupling your deployment process to a particular platform. If you're sourcing all of your variables from Azure DevOps, you can't easily test locally or migrate to a different CI/CD provider like GitHub Actions in the future.
For values that shouldn't be in source control, such a secrets, you should use a secret provider like Azure KeyVault and integrate it with your application (or, in this case, use a data resource in Terraform to pull the necessary secrets automatically at deployment time).

Variable substitution in config, JSON files in Azure DevOps Pipeline

I am a bit new in Azure DevOps. I know there is way that we can do XML transformation and JSON variable replacement. We can define key, value and json variable in library and that would update in release pipeline. Is there any way like just replacing a variable value in any file (config, json). for example I define a library value (hello = world), and Release pipeline task would find and replace $hello in config, json file and replace it with "world".
I am trying to use replace tokens as below.
Yes I was looking at same. Looks like its not replacing the values. Do you see any configuration issue as below
steps:
- task: qetza.replacetokens.replacetokens-task.replacetokens#3
displayName: 'Replace tokens in **/*.config **/*.json'
inputs:
targetFiles: |
**/*.config
**/*.json
verbosity: detailed
tokenPrefix: '{'
tokenSuffix: '}'
log as below
2020-05-11T18:44:01.6149125Z ##[section]Starting: Replace tokens in **/*.config **/*.json
2020-05-11T18:44:01.6363261Z ==============================================================================
2020-05-11T18:44:01.6363986Z Task : Replace Tokens
2020-05-11T18:44:01.6364452Z Description : Replace tokens in files
2020-05-11T18:44:01.6364873Z Version : 3.6.0
2020-05-11T18:44:01.6365252Z Author : Guillaume Rouchon
2020-05-11T18:44:01.6365919Z Help : v3.6.0 - [More Information](https://github.com/qetza/vsts-replacetokens-task#readme)
2020-05-11T18:44:01.6366694Z ==============================================================================
2020-05-11T18:44:02.2020864Z pattern: \{\s*((?:(?!\{)(?!\s*\}).)*)\s*\}
2020-05-11T18:44:02.2247835Z replaced 0 tokens out of 0 in 0 file(s) in 0.04 seconds.
2020-05-11T18:44:03.1202699Z ##[section]Finishing: Replace tokens in **/*.config **/*.json
Library value
myhello = Hello
Value in appsettngs.config
<section name="{myhello}" type="Exceptionless.ExceptionlessSection, Exceptionless" />
Yes. You can use token replace task. Please check this extension
I used your configuration (I just changed target folder to find a place wher I keep files) with this file.
steps:
- task: replacetokens#3
displayName: 'Replace tokens in *.config *.json'
inputs:
targetFiles: |
stackoverflow/23-token-replace/*.config
stackoverflow/23-token-replace/*.json
verbosity: detailed
tokenPrefix: '{'
tokenSuffix: '}'
config file:
<configuration>
<configSections>
<section name="sampleSection"
type="System.Configuration.SingleTagSectionHandler" />
<section name="{myhello}" type="Exceptionless.ExceptionlessSection, Exceptionless" />
</configSections>
<sampleSection setting1="Value1"
setting2="value two"
setting3="third value" />
</configuration>
And all went fine. Here you have a log for a build.
replacing tokens in: /home/vsts/work/1/s/stackoverflow/23-token-replace/appsettings.config
using encoding: ascii
myhello: Hello
1 tokens replaced out of 1
replaced 1 tokens out of 1 in 1 file(s) in 0.033 seconds.
All looks fine. Are you sure you have a correct targetFiles? **/*.config means that extension will look for any-folder-name/any-file-name.config located in your root folder.
The error replaced 0 tokens out of 0 in 0 file(s) in 0.04 seconds indicates the config or json files were not found in the default working directory.
Below are the possible reasons that the config/json files not found in the default working directory.
1, Your artifacts published from build pipeline is zipped. If the config/json files reside in the zipped artifacts, they cannot be found by the replacetoken task.
So you need to check if the artifacts downloaded in release pipeline is a zip file. If it is zipped, you need to add the Extract files task to unzip it before replacetoken task.
You can easily check the artifacts by clicking the 3dots highlighted in below screenshot.
2, If the config/json files are not in the default working directory. You need to specify in Root directory field the path to the folder where the config/json files reside.
Hope above helps!

Publish files with UniversalPackages#0 - "The path provided is invalid."

I'm trying to publish a file (Helloworld.txt) to my Universal Packages directory to pass on to a different stage within my Release Piepline (using UniversalPackages#0).
I cannot for the life of me figure out how to make it work.
I'm trying to follow this KB but it leaves me confused:
https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/universal-packages?view=azure-devops&tabs=yaml
For example, I can't determine what vstsFeedPublish is and don't know if vstsFeedPackagePublish can be a new name I make up on the spot or if it is actually the name of an existing file/folder.
What "path" am I entering incorrectly that's making it fail?
Stage Deployment Steps:
Helloworld Output to TXT:
cd $(Build.ArtifactStagingDirectory)
"$(System.DefaultWorkingDirectory)/Helloworld Build/Helloworld EXE Folder/Helloworld.exe" >> WriteLineOutput.txt
I cd into $(Build.ArtifactStagingDirectory) first because that is the default folder UniversalPackages#0 looks to publish files, so I want WriteLineOutput.txt to be generated there.
Publish Output TXT to Universal Dir (YAML):
steps:
- task: UniversalPackages#0
displayName: 'Publish Output TXT to Universal Dir'
inputs:
command: publish
vstsFeed: '0a3a9abd-83fd-495f-967b-e986c523f2d2'
vstsPackageVersion: 1
vstsFeedPublish: '0a3a9abd-83fd-495f-967b-e986c523f2d2'
vstsFeedPackagePublish: 'writelineoutput-txt'
versionOption: minor
packagePublishDescription: 'TXT output from Helloworld.exe'
Working Directory Structure:
"Publish Output TXT to Universal Dir" Task Output:
2019-12-02T03:35:35.2264352Z ##[section]Starting: Publish Output TXT to Universal Dir
2019-12-02T03:35:35.2381247Z ==============================================================================
2019-12-02T03:35:35.2381328Z Task : Universal packages
2019-12-02T03:35:35.2381359Z Description : Download or publish Universal Packages
2019-12-02T03:35:35.2381412Z Version : 0.160.1
2019-12-02T03:35:35.2381461Z Author : Microsoft Corporation
2019-12-02T03:35:35.2381490Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks
2019-12-02T03:35:35.2381520Z ==============================================================================
2019-12-02T03:35:36.0651445Z SYSTEMVSSCONNECTION exists true
2019-12-02T03:35:36.6058302Z Downloading: https://0t3vsblobprodcus362.vsblob.vsassets.io/artifacttool/artifacttool-win10-x64-Release_0.2.128.zip?sv=2017-04-17&sr=b&sig=tHZQU3V2DuXcC0Y1xnmzB7Zw7kMdjJSijWVDiztc9UE%3D&spr=https&se=2019-12-02T04%3A35%3A37Z&sp=r&P1=1575261037&P2=11&P3=2&P4=LS6Ffab5P%2bb8Q9r3aGsGLlK9ELRD6bRxxlTkDc5aEc8%3d
2019-12-02T03:35:39.3862184Z Caching tool: ArtifactTool 0.2.128 x64
2019-12-02T03:35:40.4414172Z SYSTEMVSSCONNECTION exists true
2019-12-02T03:35:41.4415128Z Publishing package: writelineoutput-txt, version: 0.1.0 using feed id: 65dc653c-5c3b-771c-b308-34b199d8fcee, project: null
2019-12-02T03:35:41.4469092Z [command]C:\hostedtoolcache\windows\ArtifactTool\0.2.128\x64\ArtifactTool.exe universal publish --feed 65dc653c-5c3b-771c-b308-34b199d8fcee --service https://vsrm.dev.azure.com/sawtooth-capstone/ --package-name writelineoutput-txt --package-version 0.1.0 --path D:\a\r1\a\$(Build.ArtifactStagingDirectory) --patvar UNIVERSAL_PUBLISH_PAT --verbosity None --description "TXT output from Helloworld.exe"
2019-12-02T03:35:44.0492154Z {"#t":"2019-12-02T03:35:43.3152933Z","#m":"ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"8778ba0f","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.315Z"}
2019-12-02T03:35:44.0493421Z {"#t":"2019-12-02T03:35:43.7170274Z","#m":"Ensuring that the package does not yet exist...","#i":"40e01e14","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.717Z"}
2019-12-02T03:35:44.0494251Z {"#t":"2019-12-02T03:35:43.8900269Z","#m":"Package does not yet exist","#i":"c781eca5","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.890Z"}
2019-12-02T03:35:44.0494769Z {"#t":"2019-12-02T03:35:43.8913512Z","#m":"Pushing content...","#i":"3aa40378","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.891Z"}
2019-12-02T03:35:44.0495859Z {"#t":"2019-12-02T03:35:43.9060246Z","#m":"DedupManifestArtifactClient will correlate http requests with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"09a6f3ce","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.906Z"}
2019-12-02T03:35:44.0496478Z {"#t":"2019-12-02T03:35:44.0301714Z","#m":"The path provided is invalid.","#i":"05178f7d","#l":"Error","SourceContext":"ArtifactTool.Program","UtcTimestamp":"2019-12-02 03:35:44.030Z"}
2019-12-02T03:35:44.0776082Z ##[error]Error: An unexpected error occurred while trying to push the package. Exit code(16) and error({"#t":"2019-12-02T03:35:43.3152933Z","#m":"ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"8778ba0f","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.315Z"}
{"#t":"2019-12-02T03:35:43.7170274Z","#m":"Ensuring that the package does not yet exist...","#i":"40e01e14","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.717Z"}
{"#t":"2019-12-02T03:35:43.8900269Z","#m":"Package does not yet exist","#i":"c781eca5","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.890Z"}
{"#t":"2019-12-02T03:35:43.8913512Z","#m":"Pushing content...","#i":"3aa40378","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.891Z"}
{"#t":"2019-12-02T03:35:43.9060246Z","#m":"DedupManifestArtifactClient will correlate http requests with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"09a6f3ce","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.906Z"}
{"#t":"2019-12-02T03:35:44.0301714Z","#m":"The path provided is invalid.","#i":"05178f7d","#l":"Error","SourceContext":"ArtifactTool.Program","UtcTimestamp":"2019-12-02 03:35:44.030Z"})
2019-12-02T03:35:44.0789627Z ##[error]Packages failed to publish
2019-12-02T03:35:44.0898947Z ##[section]Finishing: Publish Output TXT to Universal Dir
Key Lines:
2019-12-02T03:35:44.0496478Z {"#t":"2019-12-02T03:35:44.0301714Z","#m":"The path provided is invalid.","#i":"05178f7d","#l":"Error","SourceContext":"ArtifactTool.Program","UtcTimestamp":"2019-12-02 03:35:44.030Z"}
2019-12-02T03:35:44.0776082Z ##[error]Error: An unexpected error occurred while trying to push the package. Exit code(16) and error({"#t":"2019-12-02T03:35:43.3152933Z","#m":"ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"8778ba0f","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.315Z"}
EDIT:
Well, I read it's best practice to use the Build pipeline to publish artifacts and the Release pipeline to run/test them, so I decided to just publish the artifact from the Build pipeline instead of trying to make the same Helloworld.txt again during the Release pipeline. But I'm willing to take the inevitable downvotes if someone can help me figure out how to publish new files created in the Release pipeline into the Universal packages directory.
I'd better suggest you call exe to generate the txt file in Build. Then publish them as artifacts to release pipeline. Then you can easily pick the HelloWord.txt file in Release pipeline.
This task can be used both in Build and Release pipeline. The difference between apply this task in Build and release just be the Path to file(s) to publish value which you very confused.
For Release pipeline:
If what you want is publish the HelloWord.txt into package, just click , and then select the corresponding file HelloWord.txt from it.
So, what its value should be $(System.DefaultWorkingDirectory)/{Source alias}/{artifact name}/s/HelloWorld.txt.
Note: This way is applied when you put the txt generated in Build pipeline, and then publish them as artifact and used in release pipeline.
Similar in Build pipeline, you can also select the file from that button. For its YAML format, just input the file name like:
inputs:
command: publish
publishDirectory: 'azure-pipelines.txt'
vstsFeedPublish: '*****'
vstsFeedPackagePublish: merlin
versionOption: custom
versionPublish: 0.0.1
packagePublishDescription: published in 2019/12/2
If azure-pipelines.txt file is under a folder, just input it as a {folder name}/azure-pipelines.txt.
In your issue, if you want to put the file generate and the package publish both in Build pipeline. Since I do not very clear know how's your HellowWorld.exe script like. The location of HelloWorld.txt is decided by your script. If you did not define the generated file location in script, as default, this txt file path should same with exe. According to the pic you shared, seem its path is HelloWorld EXE Folder/HelloWorld.txt. I suggest you can use private agent firstly to run this Build to confirm its(.txt) path.
vstsFeedPublish should be the existing feed you have created in your project. Here it can not be the new name that dose not exist before the pipeline executed.
vstsFeedPackagePublish is the package name you want it stored in feed. For me as sample, here I name it as merlin. After the release finished:
You can specify a new name or use the exists one. Use a new name means create a new package in Feed, and use the exists one just means the version incremental.

How to receive Revision in Azure Pipelines YAML build definition

I created a new build with Azure Pipelines (Azure DevOps) and it worked really well.
Usually, you use $(Rev:.r) to get the revision in the build. Unfortunately, it seems the variable isn't replaced/set in the build steps. The only place where you can use it is the name: property in the YAML document.
Now I set it in the name and extract it in some PowerShell, which isn't necessary if you can get it via an environment variable.
How do I get the Revision (like $(Rev)) in the new builds (outside of the name: property in the YAML document)?
(The Build Agents running on-premise, inside Docker - but this shouldn't affect the things above)
You can't get the revision number without parsing, it is not stored as a separate field somewhere or in an environment variable.
The $(Rev:.r) portion instructs Azure DevOps to come up with the first number that makes the build number unique (and, in that specific example, put a dot in front of it).
Like you said, the only way is to use PowerShell script to get the value:
$buildNumber = $Env:BUILD_BUILDNUMBER
$revision= $buildNumber.Substring($buildNumber.LastIndexOf('.') + 1)
Edit:
You can install the Get Revision Number extension that does it.
Another possible solution to the above problem could be to use counter expression for ex: we difine the variable and use it in a task to build nuget package.
variables:
counterVar: $[counter($(versionVariable),0)]
.......
- task: CmdLine#2
inputs:
script: >
nuget pack ClassLibrary1/ClassLibrary1.csproj
-OutputDirectory $(Build.ArtifactStagingDirectory)
-NonInteractive
-Properties Configuration=release
-Version $(versionVariable).$(counterVar)
-Verbosity Detailed
-IncludeReferencedProjects
Here versionVariable is a custome variable defined in pipelines->variables.And the seed value is 0(2nd param to counter).
It works as below
Let's assume the versionVariable is 1.19
Build Run 1 counterVar will be 0.
Build Run 2 counterVar will be 1.
Now say we change the versionVariable to 1.20
Build Run 3 counterVar will be 0.
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops
Check the counter expression in above link it reset its value for diff prefix.
P.S. Benefit of using counter over $(Rev:r) is that it can start from 0 unlike $(Rev:r)

MSDeploy reporting "could not find file" when using setParamFile

I'm using MSDeploy as part of a custom task in TFS2017 (Update 1) but I can't get the setParamFile option to work. It throws one of two errors. If I specify no path, it says "could not find file" (see trace below). If I specify the path to the file on the build machine, it says invalid path.
I'm sure it's something incredibly simply but it's got me beat and Google is, for once, not being my friend! Any help is greatly appreciated.
I have provided the log unaltered as all this is only on internal servers. Without the setParamFile parameter, it deploys fine without updating the variable connection strings I'm trying to update, obviously.
2017-04-15T22:41:13.5065833Z Executing the powershell script: D:\BuildAgent\tasks\MSDeployPackageMultiSync\1.1.16\MSDeployPackageSync.ps1
2017-04-15T22:41:13.6472111Z packageFile= Find-Files -SearchPattern D:\BuildAgent\_work\194fdc7b9\Data Collection App - Release\drop\_PublishedWebsites\Cabi.FormsAdmin.Api_Package\DCA_API.zip
2017-04-15T22:41:13.6472111Z packageFile= D:\BuildAgent\_work\194fdc7b9\Data Collection App - Release\drop\_PublishedWebsites\Cabi.FormsAdmin.Api_Package\DCA_API.zip
2017-04-15T22:41:13.6784674Z DCA_API.SetParameters.xml
2017-04-15T22:41:13.7097114Z Package= D:\BuildAgent\_work\194fdc7b9\Data Collection App - Release\drop\_PublishedWebsites\Cabi.FormsAdmin.Api_Package\DCA_API.zip
2017-04-15T22:41:13.7097114Z ParamFile= -setParamFile:'DCA_API.SetParameters.xml'
2017-04-15T22:41:13.7097114Z DestinationProvider= auto
2017-04-15T22:41:13.7097114Z DestinationComputer= prerelweb3,prerelweb4
2017-04-15T22:41:13.7097114Z Username=
2017-04-15T22:41:13.7097114Z AdditionalArguments=
2017-04-15T22:41:13.7253453Z Deploying package to prerelweb3,prerelweb4
2017-04-15T22:41:13.7253453Z Deploying to prerelweb3
2017-04-15T22:41:13.7253453Z "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='D:\BuildAgent\_work\194fdc7b9\Data Collection App - Release\drop\_PublishedWebsites\Cabi.FormsAdmin.Api_Package\DCA_API.zip' -setParamFile:'DCA_API.SetParameters.xml' -dest:auto,computerName='prerelweb3',userName='',password='',authType='ntlm',includeAcls='False' -setParam:name='IIS Web Application Name',value='WebServices (Secure)\FormsAdmin' -setParam:kind=DestinationVirtualDirectory,scope='WebServices (Secure)\\FormsAdmin',value='e:\cabi_sites\WebServices_Secure\FormsAdmin' -allowUntrusted
**2017-04-15T22:41:14.1315861Z ##[error]System.Management.Automation.RemoteException: Error: Could not find file ''DCA_API.SetParameters.xml''.**
2017-04-15T22:41:14.1315861Z ##[error]System.Management.Automation.RemoteException: Error count: 1.
2017-04-15T22:41:14.1315861Z Deployment to prerelweb3 complete
2017-04-15T22:41:14.1315861Z Deploying to prerelweb4
2017-04-15T22:41:14.1315861Z "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='D:\BuildAgent\_work\194fdc7b9\Data Collection App - Release\drop\_PublishedWebsites\Cabi.FormsAdmin.Api_Package\DCA_API.zip' -setParamFile:'DCA_API.SetParameters.xml' -dest:auto,computerName='prerelweb4',userName='',password='',authType='ntlm',includeAcls='False' -setParam:name='IIS Web Application Name',value='WebServices (Secure)\FormsAdmin' -setParam:kind=DestinationVirtualDirectory,scope='WebServices (Secure)\\FormsAdmin',value='e:\cabi_sites\WebServices_Secure\FormsAdmin' -allowUntrusted
**2017-04-15T22:41:14.4909648Z ##[error]System.Management.Automation.RemoteException: Error: Could not find file ''DCA_API.SetParameters.xml''.**
2017-04-15T22:41:14.4909648Z ##[error]System.Management.Automation.RemoteException: Error count: 1.
2017-04-15T22:41:14.4909648Z Deployment to prerelweb4 complete
I assume that you are using this task: MSDeployAllTheThings. According to the logs, you are using it from Release. So you need to make sure that the "DCA_API.SetParameters.xml" file is published to artifact drop during the build and is also downloaded correctly during release. And then, you need to enter the absolute path in the Additional Arguments so that the task can find the file. For your scenario, if the "DCA_API.SetParameters.xml" file is placed in the same folder with "DCA_API.zip" file, you need to use this:
-setParamFile:"D:\BuildAgent\_work\194fdc7b9\Data Collection App - Release\drop\_PublishedWebsites\Cabi.FormsAdmin.Api_Package\DCA_API.SetParameters.xml"
I tried with absolute path at my side and didn't see any issue with it.