YAML pipeline looks like below
parameters:
- name: parameter1
type: string
steps:
task: PowerShell@2
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
Write-Host ${{ parameters.parameter1 }}
C# code to queue build is like
var build = new Build()
{
Definition = definition,
Project = project
};
var dict = new Dictionary<string, string> { { "parameter1", "parametervalue" } };
build.Parameters = JsonSerializer.Serialize(dict);
buildClient.QueueBuildAsync(build).Wait();
I get exception Could not queue the build because there were validation errors or warnings. A value for the 'parameter1' parameter must be provided. Any idea to fix this issue would be helpful.
It looks that this is not possible at the moment to run pipeline with passing runtime parameters over C# SDK. You found workaround using REST API.
This is not an issue with SDK. They are developed in their own pace. So functionality which is available in REST API is not always available at the same moment in SDK. It could be available in the future, but for the moment if you want to run it programmatically you need to use REST API.