Skip to content

Support Microsoft.Testing.Platform in GlobalJsonCreator #360

Closed

Description

@martincostello

I noticed the new GlobalJsonCreator class and thought I'd swap to using it in one of my projects, but in some cases I need to enable use of MTP for tests, and there's no way to do that through the new class.

This is what I currently do:

private static string CreateGlobalJson(string sdkVersion, bool useMtp = false)
{
    var globalJson = new JsonObject()
    {
        ["sdk"] = new JsonObject()
        {
            ["version"] = sdkVersion,
        },
    };

    if (useMtp)
    {
        globalJson["test"] = new JsonObject()
        {
            ["runner"] = "Microsoft.Testing.Platform",
        };
    }

    return globalJson.ToJsonString();
}

Ideally I'd be able to do something like this instead:

private static string CreateGlobalJson(string sdkVersion, bool useMtp = false)
{
    var creator = GlobalJsonCreator.Create(
        directory: Environment.CurrentDirectory,
        sdkVersion: sdkVersion);

    if (useMtp)
    {
        creator.TestRunner("Microsoft.Testing.Platform");
    }

    return creator.ToJson();
}

Activity

  1. jeffkl commented on Jun 19, 2026

    @jeffkl
    Owner

    Great suggestion, I didn't realize there were new options in global.json. I'll add all of the ones that are documented at https://learn.microsoft.com/en-us/dotnet/core/tools/global-json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions