Closed greenkalx closed 11 months ago
That seems to be an error with finding MSBuildLocator, not an error with using MSBuildLocator. (Your code, though it doesn't do much, looks correct.) See https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/add-type?view=powershell-7.3#-referencedassemblies
Close since no customer reply.
Feel free to ping us in the ticket again if the issue still persists.
I'm trying to use MSBuildLocator in Powershell with the end goal of parsing C# and C++ projects with ProjectLoader in the dotnet samples: https://github.com/dotnet/samples/blob/main/github-actions/DotNet.GitHubAction/DotNet.CodeAnalysis/ProjectLoader.cs
The Powershell script below fails to load the locator assembly, with error:
Add-Type : Could not load file or assembly '.\\Microsoft.Build.Locator' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Are there any examples of this?