Skip to content

Add config file support - #10

Merged
Ben McMorran (benmcmorran) merged 3 commits into
microsoft:mainfrom
gcampbell-msft:dev/gcampbell/config
Jul 20, 2026
Merged

Add config file support#10
Ben McMorran (benmcmorran) merged 3 commits into
microsoft:mainfrom
gcampbell-msft:dev/gcampbell/config

Conversation

@gcampbell-msft

Copy link
Copy Markdown
Collaborator

Add JSON config-file support

Summary

Adds an optional JSON config file so the extractor can supply its options from a file instead of (or alongside) the command line. This lets the tool run with no arguments when a config is present.

Behavior

•  --config   flag to point at a config file explicitly (also supports  --config= ).
• Auto-detection: when  --config  is omitted, a  msbuild-extractor.json  in the current directory is loaded automatically if present.
• Precedence: command line > config file > built-in defaults. Config values are wired as each option's default, so any flag passed on the command line still wins.
• Input requirement: at least one  projects  or  solutions  entry must come from the config file or the command line.  projects  and  solutions  are additive — both may be set and are extracted together.
• Path resolution: relative paths in the config resolve from the config file's own directory.

Notes

• The example is named  msbuild-extractor.example.json  (not  msbuild-extractor.json ) so it isn't auto-loaded when running from the repo root.

Ion Todirel (itodirel) and others added 2 commits July 20, 2026 11:04
…actor.json)

Options can now be supplied from a JSON file so the extractor can run with no
command-line parameters. A msbuild-extractor.json in the current directory is used
automatically; otherwise pass one with --config <path>. Command-line options override
file values, which override built-in defaults.

- Config.cs: a single config type whose instance Load(args) discovers the file (--config
  or ./msbuild-extractor.json), reads it, validates enum values, and resolves relative paths
- CommandLineOptions.cs: seed option defaults from the config, add --config, merge msbuild
  property/env maps, expose ConfigPath
- Program.cs: report the config file in use
Comment thread README.md
Comment thread CommandLineOptions.cs
@benmcmorran
Ben McMorran (benmcmorran) merged commit ac8ed80 into microsoft:main Jul 20, 2026
2 checks passed
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.

3 participants