Gray Wolf Corporation

upgrading to setup-dotnet@v4 requires quotes around paths with spaces

I wanted to bring my github action yaml up to the latest versions (v4), but ran into problems with the "simple" dotnet publish command.

I moved from setup-dotnet@v1 to setup-dotnet@v4, which now has a requirement to enclose any path with spaces in double quotes.

v1:

dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

v4:

dotnet publish -c Release -o "${{env.DOTNET_ROOT}}/myapp"

If you miss this and your output folder has a space in the path, the publish action will error out with: MSBUILD : error MSB1008: Only one project can be specified.

v1 had an output path with no spaces, where v4 goes to program files - nice!

Notice below how the -o command stops at c:\Program and the rest is passed with the project parameter, making it look like two files are being passed to the switch. yuck.

publish-bad

Here is the run after quoting the output directory:

publish-good

An unhandled error has occurred. Reload 🗙