1

I'm trying to build a project which requires to set the working directory to a path.

On my local machine I could go with Visual Studio 2019 and go to Project - Properties - Debugging - Command Arguments and set it to whatever I want. The problem is that I don't know how to do with Visual Studio build task.

If I do not set this settings, it produces an executable that doesn't launch.

here is my build pipeline: https://dev.azure.com/nathanvalletmarseille/armorpaint/_build?definitionId=5&_a=summary

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Xephobia
  • 33
  • 2
  • 6

1 Answers1

2

It's not able to directly set this with build-in visual studio build task.

However, you could do this through a script before you run the build task:

- script: # script path or inline
  workingDirectory: #
  displayName: #
  failOnStderr: #
  env:  # mapping of environment variables to add

More details take a look at this similar question: Change current working directory in Azure Pipelines

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • hello, do you mean doing cd mydirectory or set it in the working directory parameter? – Xephobia May 26 '20 at 07:19
  • And do i would need to run Visual studio trough command line? – Xephobia May 26 '20 at 07:19
  • @Xephobia You can just use `workingDirectory: subfolder/` at each step inside your YAML where subfolder is relative to repository root. Actually the sample is using YAML pipeline. https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema%2Cparameter-schema Yes, you need to call MSBuild command line to run the build. – PatrickLu-MSFT May 26 '20 at 07:35