Reputation: 6842
I have a solution with 5 projects and have realized I really do not understand what im doing when looking at the options in an azure pipeline build. Mainly my confusion is in dealing with the different paths and predefined variables that are part of the pipeline environment. I've been watching a ton of youtube and pluralsight videos. I get the basic concepts, its some of the details that I'm stumbling over.
So here is part of the yaml file.
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:OutputPath="$(Build.BinariesDirectory)\$(Build.BuildId)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
Questions:
(1) The solution variable is obviously mapping to any sln file via wildcards, but relative to what path?
(1a) How does one specify an individual project within a solution containing multiple projects?
(2) When the build task executes, what path is this being done in ?
(3) Nowhere in the docs (that I could see) does it say you need to construct a path for the output of the build task, I had to find someone elses example. If the above task didn't provide /p:OutputPath values, where would the build results be found?
(4) Build.BinariesDirectory - if this is relative to a hosted build agent, is this secure if config files with passwords are part of the build? In other words, since I am sharing a hosted version of a visual studio instance, are my files ever accessible to other users even by accident?
Upvotes: 0
Views: 1522
Reputation: 1882
All paths are locations within the Pipeline.Workspace
folder.
1: the wildcard is relative to the Build.SourcesDirectory
folder.
1a: the solution
property also support a project file instead of a solution to build a single project
2: I don't understand the question. Do you want to know the working folder the msbuild task is executed in? Why do you need to know this
3: by default, the project builds to the output path specified in the project file. This is usually a relativebin
folder in the project directory.
4: build.binariesdirecrory
is an absolute path. If you share the build machine with others users any have sensitive data in this folder you should clear it at the end of your pipeline. If you use a microsoft hosted pipeline agent, you don't need to clean it. Each build provisions a clean build agent. Other users won't be able to access your files
Also see https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
Upvotes: 1