Skip to content

Combine the intermediate path rather than prepending it - #202

Open
Smaug123 wants to merge 2 commits into
mainfrom
intermediate-output-path
Open

Combine the intermediate path rather than prepending it#202
Smaug123 wants to merge 2 commits into
mainfrom
intermediate-output-path

Conversation

@Smaug123

Copy link
Copy Markdown
Owner

Follow-up to the readme-strip target: IntermediateOutputPath is relative to the project directory by default, but absolute under the SDK's UseArtifactsOutput (and under an explicit BaseIntermediateOutputPath). Prepending $(MSBuildProjectDirectory) then produces <project>/<absolute path>, so dotnet pack -p:UseArtifactsOutput=true wrote the stripped readme into a <project>/Users/... tree inside the source directory instead of into the configured artifacts directory. On Windows the same concatenation would be a malformed double-drive path.

Path.Combine returns a rooted second argument unchanged, which is the wanted behaviour in both modes.

Verified in this repo: the property resolves under obj/ by default and under artifacts/obj/ with the switch; packing with the switch produces a nupkg whose readme is byte-identical to main's readme minus its <picture> element, still carries the icon, and leaves no stray directory in the source tree.

Found by Codex reviewing the same target in WoofWare.Incremental; the identical fix is going to every repo that carries it.

`IntermediateOutputPath` is relative to the project directory by default, but
absolute under the SDK's `UseArtifactsOutput` (and under an explicit
`BaseIntermediateOutputPath`). Prepending `$(MSBuildProjectDirectory)` then
produced `<project>/<absolute path>`, so packing with that switch wrote the
stripped readme into a `<project>/Users/...` tree under the source directory
instead of into the configured artifacts directory; on Windows the same
concatenation would be a malformed double-drive path.

`Path.Combine` returns a rooted second argument unchanged, which is what is
wanted in both modes. Verified by resolving the property both ways and by
packing with the switch: the readme in the nupkg is byte-identical to the one
on `main` minus its `<picture>` element, the icon is still present, and no
stray directory appears in the source tree.
AGENTS.md asks for no comments discussing alternative counterfactual
implementations. State why `Path.Combine` is the right call here instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant