Closed mieliespoor closed 1 year ago
@mieliespoor For specifying parameters that need to be passed to dotnet publish
, you need to use --msbuild-parameters
parameter (looks like you are already using one). So in you case (for passing multiple parameters), this should be dotnet lambda package ... --msbuild-parameters "/p:Version=0.0.16 --no-build --no-restore"
. I tested it and it works:
Executing publish command
Deleted previous publish folder
... invoking 'dotnet publish', working folder '/Users/<<user>>/dev/repros/MyFunction/src/MyFunction/bin/Release/netcoreapp3.1/publish'
... dotnet publish --output "/Users/<<user>>/dev/repros/MyFunction/src/MyFunction/bin/Release/netcoreapp3.1/publish" --configuration "Release" --framework "netcoreapp3.1" /p:Version=0.0.16 --no-build --no-restore /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained false
... publish: MSBuild version 17.3.0+92e077650 for .NET
Thanks, Ashish
That fixed it. This is somewhat misleading as the --no-build
flag is technically not a msbuild parameter, but rather dotnet cli. Another issue I picked up on our side is that we didn't wrap the msbuild-parameters in quotes. Once this has been done, this worked as expected.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
when calling
dotnet lambda package --no-build
, the expectation is that this is passed on to the donet publish command by the lambda tools. This however doesn't appear to happen.When the dotnet publish command is run, the
--no-build
flag is missing which results in a dotnet restore happening. There is no way to then control what sources this then uses to restore the packages. This could lead to unexpected behaviour leading to the command failingExpected Behavior
The
--no-build
and/or--no-restore
commands are passed through to thedotnet publish
commandCurrent Behavior
The
--no-build
and--no-restore
commands are discarded by the dotnet lambda publish command.Reproduction Steps
dotnet lambda package --no-build --no-restore --msbuild-parameters /p:Version=0.0.16 --project-location "/path/to/solution" --configuration "Release" --output "/path/to/output/s3/0.0.16.zip" --disable-interactive true
Possible Solution
No response
Additional Information/Context
No response
Targeted .NET platform
net 6
CLI extension version
5.4.4
Environment details (OS name and version, etc.)
Ubuntu 20.04