I do not understand the sentence "arguments are ignored when the type is inline."
Can you please explain how can I run inline PowerShell script with arguments, for example, something like this?
param ($Name)
"Hello $Name"
This functionality was present in v1, and it is required feature for "Task Group" functionality, but it is missing now. I cannot go back to v1, due to its limitations.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I'm interested in this as well. Using inline tasks with task groups doesn't behave properly without it. To reference an "argument" in the script you have to use the $(Arg) syntax. But if this is a string you have to then enclose it in single or double quotes. But if the argument value contains single or double quotes then that messes up the script. See here. There doesn't seem to be any way to pass parameters from a task group to a PowerShell inline script AND allow the parameter to contain single/double quotes unless you manually try to enforce some rules. Having inline accept script arguments would solve this I believe.
Inline scripts aren't reusable, so it doesn't make a lot of sense for them to be written to take parameters. We expect that an inline script takes direct dependencies on anything it needs, such as environment variables.
I don't understand this:
There doesn't seem to be any way to pass parameters from a task group to a PowerShell inline script
@vtbassmatt: We use inline scripts as part of Task groups. They can be reused by many different build definitions and that's why we need the parameters!
For now I cannot use the powershell 2.x task, but have to use the 1.x version.
@PainElemental Or you could just use files instead of scripts. Might be helpful if you could create a short YAML pipeline of the problem.
I'm tweaking the docs slightly, and I've reactivated a bug in the agent repo to consider making arguments work with inline scripts. It's a product issue, not a doc issue, so I'll be closing this one.