Skip to content

[Repo Assist] Add --msbuild-global-property CLI option for design-time project loading#1524

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-msbuild-global-property-cli-1057-85c1c29b12ee8fc1
Draft

[Repo Assist] Add --msbuild-global-property CLI option for design-time project loading#1524
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-msbuild-global-property-cli-1057-85c1c29b12ee8fc1

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 8, 2026

🤖 This is an automated pull request from Repo Assist, an automated AI assistant.

Closes #1057
Closes #1475

Summary

Adds a new --msbuild-global-property (alias --msbuild-prop) CLI flag that lets users pass extra MSBuild global properties to FsAutoComplete's design-time project loader.

Usage:

fsautocomplete --msbuild-global-property Configuration=Release
fsautocomplete --msbuild-prop MyCustomProp=1 --msbuild-prop AnotherProp=Value

This is useful when the default Debug configuration doesn't load correctly, or when projects use custom MSBuild properties for conditional compilation.

Root Cause / Motivation

Issue #1057 notes that FSAC always loads projects in Debug configuration. Users want to override this (e.g., to use Release or a custom configuration) without editing project files. Issue #1475 was filed explicitly requesting this CLI flag.

Implementation

src/FsAutoComplete/Parser.fs — 24 lines changed, 0 lines deleted:

  1. Declared a new msBuildGlobalPropertyOption (Option<string[]>) with AllowMultipleArgumentsPerToken = true, so each flag invocation can accept one or more KEY=VALUE pairs.
  2. Registered it with rootCommand.Options.Add.
  3. In SetAction, parse the values by splitting on the first = (so values containing = are handled correctly).
  4. Merge the parsed pairs with ProjectLoader.globalProperties and pass the combined list to both WorkspaceLoader.Create and WorkspaceLoaderViaProjectGraph.Create.

No other files were changed. This is intentionally minimal and non-breaking.

Trade-offs

  • Parsing: We split on the first = only, so FOO=bar=baz sets FOO to bar=baz. Pairs with no = are silently ignored with a non-matching pattern. This is consistent with how MSBuild itself handles the /p: syntax.
  • Override semantics: Later entries in the list win because Ionide.ProjInfo uses the list as MSBuild global properties, where last-write wins. Since extraMsBuildProperties is appended after ProjectLoader.globalProperties, user-supplied values override defaults.
  • No new dependencies: System.CommandLine is already used throughout Parser.fs.

Test Status

Build passed: dotnet build src/FsAutoComplete/FsAutoComplete.fsproj -f net8.0 — 0 warnings, 0 errors.

Formatter: dotnet fantomas src/FsAutoComplete/Parser.fs — no changes (already well-formatted).

Note: no new automated tests were added for this change. The flag wires into the existing workspace loader infrastructure and the observable effect is MSBuild-level (properties visible during project evaluation). Existing LSP integration tests exercise the workspace loader path indirectly.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@7ee2b60744abf71b985bead4599640f165edcd93

Closes #1057
Closes #1475

Allow users to pass extra MSBuild global properties to the workspace
loader via a new --msbuild-global-property (alias --msbuild-prop) CLI flag.
Each value is a KEY=VALUE pair; the flag may be specified multiple times.

  fsautocomplete --msbuild-global-property Configuration=Release \
                 --msbuild-prop MyCustomProp=1

The parsed pairs are merged with the existing ProjectLoader.globalProperties
list and forwarded to both WorkspaceLoader and WorkspaceLoaderViaProjectGraph.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

0 participants