Skip to content

Version 1.5.3 misses a trailing directory separator path #176

@CamiloTerevinto

Description

@CamiloTerevinto

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions