-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updating the Get-MsBuildPath function #422
base: main
Are you sure you want to change the base?
Conversation
… vs studio versions since it causes assembly conflict.
@microsoft-github-policy-service agree company="Microsoft" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly agree with the direction here.
Co-authored-by: Rainer Sigwald <[email protected]>
$msUtilities = [System.Reflection.Assembly]::LoadFrom($msbuildUtilitiesPath) | ||
[object]$archValue = $null | ||
if ($Architecture -eq 'x86') { | ||
$msBuildPath = Join-Path $specifiedStudio.installationPath MSBuild Current Bin MSBuild.exe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works with powershell 7.4+
On my machine it breaks with Windows Powershell since I probably have some older version.
Is that something we should be concerned about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Join-Path $specifiedStudio.installationPath MSBuild Current Bin MSBuild.exe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok that's a very convincing reason!
(As a rule Windows PowerShell 5.1 is the only "real" one; the new cross-platform ones are much better but since they don't come with Windows can't be relied upon in the same way.)
to avoid reflection for the new vs studio versions since it causes assembly conflict.
Related issue 20734
This portion of the Get-MsBuildPath function script first locates Microsoft.Build.Utilities.Core.dll and then uses it to locate the msbuild.exe. Under the current preview version of VS this fails due to an assembly conflict.
Fortunately for us, the reflection usage here is redundant, since the msbuild exe lives either in the same folder as this .dll file or in its direct subfolder.
These paths are fixed due to the way VS installation works - e.g. if we have location of the .dll file, we have the location of both of these versions of msbuild.