dotnet / dotnet/msbuild

Support forcing singular -getproperty to return JSON

Open
#12,490 1 comment 0 reactions 1 assignee Claimed by @baronfel View on GitHub
Area: Application User Experience
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

We are using `dotnet msbuild -getproperty` quite a bit in Aspire to interrogate project files to manage things like updates and other things. One thing caught me out today whilst I was adding a new feature to the Aspire CLI where I was making a call to `dotnet msbuild -getproperty` with a single property and the output flipped from JSON to just plain text breaking out output parsing logic.

This is pretty bad for the CLI tool to do this! Given this behavior has already shipped I think we need a way to force even singular `-getproperty` usage to always return JSON output. Because of this I'm having to put an unnecessary property in to an invocation just as a hack.

Here is the problematic code:

https://github.com/dotnet/msbuild/blob/b727825214bac58fbf1ca43e9a50a3f9b6cac3b3/src/MSBuild/XMake.cs#L1087

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.