[Repo Assist] Add --msbuild-global-property CLI option for design-time project loading#1524
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Draft
Conversation
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>
26 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 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:
This is useful when the default
Debugconfiguration 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
Debugconfiguration. Users want to override this (e.g., to useReleaseor 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:msBuildGlobalPropertyOption(Option<string[]>) withAllowMultipleArgumentsPerToken = true, so each flag invocation can accept one or moreKEY=VALUEpairs.rootCommand.Options.Add.SetAction, parse the values by splitting on the first=(so values containing=are handled correctly).ProjectLoader.globalPropertiesand pass the combined list to bothWorkspaceLoader.CreateandWorkspaceLoaderViaProjectGraph.Create.No other files were changed. This is intentionally minimal and non-breaking.
Trade-offs
=only, soFOO=bar=bazsetsFOOtobar=baz. Pairs with no=are silently ignored with a non-matching pattern. This is consistent with how MSBuild itself handles the/p:syntax.Ionide.ProjInfouses the list as MSBuild global properties, where last-write wins. SinceextraMsBuildPropertiesis appended afterProjectLoader.globalProperties, user-supplied values override defaults.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.