Is there any reason why MSBuild is not located from within LinqPad?

Options
async Task Main()
{
    if (!MSBuildLocator.IsRegistered)
    {
        MSBuildLocator.RegisterDefaults();
    }

    using (var w = MSBuildWorkspace.Create())
    {
        var sln = await w.OpenSolutionAsync(@"...");
    }
}

MSBuildLocator.RegisterDefaults(); throws

InvalidOperationException: No instances of MSBuild could be detected.
Try calling RegisterInstance or RegisterMSBuildPath to manually register one.

Yet running same code as console application works fine.

Comments