-
Notifications
You must be signed in to change notification settings - Fork 98
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
Getting the full path to MSBuild.exe #74
Comments
On a more general note: Is this tool in any way intended to be runnable on a build server which ONLY has MS Build Tools installed, i.e. no version of Visual Studio? EDIT: Having read through #41 I guess I'll look somewhere else :( |
you can try something like this if you need only full path to msbuild from VS2017+ through vswhere: ...
for /f "usebackq tokens=1* delims=: " %%a in (`!vswbin! -latest -requires Microsoft.Component.MSBuild`) do (
if /i "%%a"=="installationPath" set vspath=%%b
if /i "%%a"=="installationVersion" set vsver=%%b
)
...
for /f "tokens=1,2 delims=." %%a in ("!vsver!") do (
set vsver=%%a.%%b
)
set msbuildPath=!vspath!\MSBuild\!vsver!\Bin this part from hMSBuild helper that you already noticed above (we're using this for simple access to msbuild tools -_- as a common tool for all VS & .NET versions) just to be clear, the latest version also already supports a local vswhere tool (#41 *now I updated info there) and via key -vswhere-version {num} - Specific version of vswhere. Where {num}:
* Versions: 1.0.50 ...
* Keywords:
`latest` to get latest available version;
`local` to use only local versions:
(.bat;.exe /or from +15.2.26418.1 VS-build);
|
Thanks for the reply, I've already downloaded hMSBuild.bat and am working on getting it into our build system :) |
Also, as of Visual Studio 2017 version 15.2 vswhere will always be available in %ProgramFiles(x86)%\Microsoft Visual Studio\Installer if VS, Build Tools, Remote Tools, or other 2017 family of products or newer is installed. But that still doesn't change the fact that support for |
Hi
I feel like I'm missing some obvious way to determine the full path to
MSBuild.exe
.To illustrate, here's where we're at currently:
Run
vswhere.exe -latest -requires Microsoft.Component.MSBuild -property installationFolder
.The return value "C:\Path\To\VisualStudio\Root" seems useless, because we have to make an additional assumption reg. the location of
MSBuild.exe
inside that folder.We could append "\MSBuild\15.0\MSBuild\bin\MSBuild.exe", but that seems to defeat the purpose of not making assumptions/including hard coded paths in our build scripts.
Run
vswhere.exe -latest -requires Microsoft.Component.MSBuild -property installationVersion
.The return value "15.0.26430.6" seems useless, because the actual path is "C:\Path\To\My\VisualStudio\Root\15.0\" which means we'd again need to do additional handling, e.g. using either a 2 or 3 digit substring based on whether the major revision is less than/greater than 10.
The text was updated successfully, but these errors were encountered: