Repository navigation
Conversation
Co-authored-by: MiYanni <17788297+MiYanni@users.noreply.github.com>
Co-authored-by: MiYanni <17788297+MiYanni@users.noreply.github.com>
Co-authored-by: MiYanni <17788297+MiYanni@users.noreply.github.com>
Co-authored-by: MiYanni <17788297+MiYanni@users.noreply.github.com>
Co-authored-by: MiYanni <17788297+MiYanni@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes dotnet <command> -o/--output failures when the computed output path contains MSBuild special characters (e.g., ;, %, $) by escaping them before forwarding the property value to MSBuild.
Changes:
- Added an
EscapeMSBuildPropertyValuehelper to percent-encode MSBuild special characters in property values. - Updated
ForwardAsOutputPathto escape the full output path before optional quote-wrapping and forwarding to MSBuild. - Added new MSBuild invocation tests for
dotnet publish -oanddotnet build -oto validate escaping behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Cli/dotnet/Extensions/OptionForwardingExtensions.cs |
Introduces MSBuild property escaping and applies it to all output-path forwarding. |
test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetPublishInvocation.cs |
Adds tests asserting PublishDir is forwarded with escaped special characters. |
test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetBuildInvocation.cs |
Adds tests asserting OutputPath is forwarded with escaped special characters. |
Co-authored-by: MiYanni <17788297+MiYanni@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/sdk/sessions/ca3dbf6d-8c5e-4c35-a5ce-ef53835ecedc
|
@dotnet/kitten to review this as well since it is special casing msbuild chars. |
|
I assume you don't want to use MSBuild APIs in that code path? |
Good point, and in case we can use them, |
@ViktorHofer I don't know the specifics here. It was a "just throw it at Copilot" kind of task. After next week, I'll be out for a while. Not sure how to get this moved forward. If not, I can just close it. |
|
Closing as I won't be able to get around to this before I'm on break (EoD). |
dotnet publish -ofails when the output directory contains MSBuild special characters (;,%,$, etc.) because MSBuild interprets them as delimiters/references:Changes
EscapeMSBuildPropertyValueto percent-encode MSBuild special characters (;→%3B,%→%25,$→%24, etc.)ForwardAsOutputPathto escape paths before forwarding to MSBuildImpact
Applies to all commands using
ForwardAsOutputPath:publish,build,clean,store.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
learn.microsoft.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.