-
Notifications
You must be signed in to change notification settings - Fork 89
Description
Describe the bug
I am executing the following command via a JS Github Action:
dotnet lambda package --disable-interactive True --project-location /sources/dotnet/lambda/src --output-package publish/output.zip --function-runtime dotnet8 --function-architecture arm64 --msbuild-parameters "--no-restore --no-build"
I need the ability to pass multiple arguments via msbuild-parameters flag and thus I've encapsulated them into double quotes as requested by the help manual. Both --no-restore and --no-build here are appended as a single command-line argument and are not parsed by dotnet correctly, instead being set on MSBuild call and failing the execution.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
I expect this to be called:
dotnet publish "/sources/dotnet/lambda/src" --output "/sources/dotnet/lambda/src/bin/Release/net8.0/publish" --configuration "Release" --framework "net8.0" --no-restore --no-build /p:GenerateRuntimeConfigurationFiles=true --runtime linux-arm64 --self-contained False
Current Behavior
I get this result instead:
dotnet publish "/sources/dotnet/lambda/src" --output "/sources/dotnet/lambda/src/bin/Release/net8.0/publish" --configuration "Release" --framework "net8.0" "--no-restore --no-build" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-arm64 --self-contained False
.NET isn't parsing --no-restore and --no-build because it didn't recognize them and thus it passed these down to msbuild it seems like.
... publish: MSBUILD : error MSB1001: Unknown switch.
... publish: Full command line: 'MSBuild.dll -maxcpucount -verbosity:m -nologo -target:Restore --property:_IsPublishing=true --property:GenerateRuntimeConfigurationFiles=true -property:PublishDir=/sources/dotnet/lambda/src/bin/Release/net8.0/publish -property:_CommandLineDefinedOutputPath=true -property:SelfContained=False -property:_CommandLineDefinedSelfContained=true -property:RuntimeIdentifier=linux-arm64 -property:_CommandLineDefinedRuntimeIdentifier=true -property:Configuration=Release -property:DOTNET_CLI_DISABLE_PUBLISH_AND_PACK_RELEASE=true /sources/dotnet/lambda/src --no-restore --no-build -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/.dotnet/sdk/8.0.404/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/.dotnet/sdk/8.0.404/dotnet.dll'
... publish: Switches appended by response files:
... publish: Switch: --no-restore --no-build
... publish: For switch syntax, type "MSBuild -help"
ERROR: The dotnet publish command return unsuccessful error code
Reproduction Steps
I already tried the following:
- Splitting every publish argument I want applied into a separate argument prepended with msbuild-properties:
args.push(...this.inputs.publishArgs.split(/\s+/).flatMap(a => [--msbuild-parameters, a])); - Dropping all arguments without any quotation marks after msbuild-parameters:
args.push(--msbuild-parameters, ...this.inputs.publishArgs.split(/\s+/)); - Encapsulating parameters into single and double quotes in order to group them:
args.push(--msbuild-parameters,'${this.inputs.publishArgs}'); - Setting parameters via an equal sign:
args.push(--msbuild-parameters="${this.inputs.publishArgs}");
None of these provide the desired results. Some of these result into missing arguments (effectively just ignoring them), others fail with the error of MSBuild not recognizing given options.
Later after these args are set they are fed into an actions/exec package which then spawns them in a child_process.
await exec(cmd, args, opt);
Possible Solution
No response
Additional Information/Context
No response
Targeted .NET platform
.NET 8
CLI extension version
Package Id Version Commands
amazon.lambda.tools 5.12.3 dotnet-lambda
Environment details (OS name and version, etc.)
RHEL9