In a project, where the MS Build instance is registered with MSBuildLocator.RegisterDefaults(); before calling a method that ends up doing:
var globalProperties = new Dictionary<string, string>
{
{ "SolutionDir", $"{Path.GetDirectoryName("path")}{Path.DirectorySeparatorChar}" }
};
var projectCollection = new ProjectCollection(globalProperties);
var project = projectCollection.LoadProject("path");
Both the above and doing just new Project("path"); fails with an InvalidProjectFileException.
Looking at the ProjectCollection, the difference between Microsoft.Build.Locator 1.4.1 and 1.5.3 is in ProjectCollection.Toolsets[0]._properties[0].
1.4.1: "MSBuildSDKsPath"="C:\\Program Files\\dotnet\\sdk\\6.0.303\\Sdks"
1.5.3: "MSBuildSDKsPath"="C:\\Program Files\\dotnet\\sdk\\6.0.303Sdks"
This might need to be fixed in the Microsoft.Build.Evaluation package instead of here, though.
In a project, where the MS Build instance is registered with
MSBuildLocator.RegisterDefaults();before calling a method that ends up doing:Both the above and doing just
new Project("path");fails with anInvalidProjectFileException.Looking at the
ProjectCollection, the difference between Microsoft.Build.Locator 1.4.1 and 1.5.3 is inProjectCollection.Toolsets[0]._properties[0].1.4.1:
"MSBuildSDKsPath"="C:\\Program Files\\dotnet\\sdk\\6.0.303\\Sdks"1.5.3:
"MSBuildSDKsPath"="C:\\Program Files\\dotnet\\sdk\\6.0.303Sdks"This might need to be fixed in the
Microsoft.Build.Evaluationpackage instead of here, though.