You've already forked setup-msbuild
mirror of
https://github.com/microsoft/setup-msbuild.git
synced 2025-07-29 09:54:49 +07:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
ab534842b4 | |||
84e0d709b2 | |||
613696a2a0 | |||
6c2e301a93 | |||
0cd944e169 | |||
aaa8d4fac0 | |||
323ede3ce9 | |||
dfaf113754 | |||
33941d8101 | |||
8611b39e1b | |||
2cbcfcb795 | |||
a7d39343f8 | |||
412f270368 | |||
047d9a0678 | |||
9afe006fef | |||
babd7930ed | |||
7626c90a39 |
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@ -33,6 +33,13 @@ jobs:
|
||||
env:
|
||||
PATH: ''
|
||||
|
||||
- name: Setup MSBuild (x64)
|
||||
id: setup_msbuild_path
|
||||
uses: ./
|
||||
with:
|
||||
vs-prerelease: true
|
||||
msbuild-architecture: 'x64'
|
||||
|
||||
- name: echo msbuild path
|
||||
run: |
|
||||
echo "vswhere-path: ${{ steps.setup_msbuild_explicit.outputs.msbuildPath }}"
|
||||
|
@ -14,6 +14,10 @@ inputs:
|
||||
vs-prerelease:
|
||||
description: 'Enable searching for pre-release versions of Visual Studio/MSBuild'
|
||||
required: false
|
||||
msbuild-architecture:
|
||||
description: 'The preferred processor architecture of MSBuild. Can be either "x86" or "x64". "x64" is only available from Visual Studio version 17.0 and later.'
|
||||
required: false
|
||||
default: 'x86'
|
||||
outputs:
|
||||
msbuildPath:
|
||||
description: 'The resulting location of msbuild for your inputs'
|
||||
|
22
dist/index.js
vendored
22
dist/index.js
vendored
@ -1041,6 +1041,7 @@ const IS_WINDOWS = process.platform === 'win32';
|
||||
const VS_VERSION = core.getInput('vs-version') || 'latest';
|
||||
const VSWHERE_PATH = core.getInput('vswhere-path');
|
||||
const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false';
|
||||
const MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86';
|
||||
// if a specific version of VS is requested
|
||||
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest ';
|
||||
if (ALLOW_PRERELEASE === 'true') {
|
||||
@ -1089,16 +1090,27 @@ function run() {
|
||||
stdout: (data) => {
|
||||
const installationPath = data.toString().trim();
|
||||
core.debug(`Found installation path: ${installationPath}`);
|
||||
let toolPath = path.join(installationPath, 'MSBuild\\Current\\Bin\\MSBuild.exe');
|
||||
core.debug(`Checking for path: ${toolPath}`);
|
||||
if (!fs.existsSync(toolPath)) {
|
||||
toolPath = path.join(installationPath, 'MSBuild\\15.0\\Bin\\MSBuild.exe');
|
||||
// x64 only exists in one possible location, so no fallback probing
|
||||
if (MSBUILD_ARCH === "x64") {
|
||||
let toolPath = path.join(installationPath, 'MSBuild\\Current\\Bin\\amd64\\MSBuild.exe');
|
||||
core.debug(`Checking for path: ${toolPath}`);
|
||||
if (!fs.existsSync(toolPath)) {
|
||||
return;
|
||||
}
|
||||
foundToolPath = toolPath;
|
||||
}
|
||||
else {
|
||||
let toolPath = path.join(installationPath, 'MSBuild\\Current\\Bin\\MSBuild.exe');
|
||||
core.debug(`Checking for path: ${toolPath}`);
|
||||
if (!fs.existsSync(toolPath)) {
|
||||
toolPath = path.join(installationPath, 'MSBuild\\15.0\\Bin\\MSBuild.exe');
|
||||
core.debug(`Checking for path: ${toolPath}`);
|
||||
if (!fs.existsSync(toolPath)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
foundToolPath = toolPath;
|
||||
}
|
||||
foundToolPath = toolPath;
|
||||
}
|
||||
};
|
||||
// execute the find putting the result of the command in the options foundToolPath
|
||||
|
8310
package-lock.json
generated
8310
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-msbuild",
|
||||
"version": "1.0.3",
|
||||
"version": "1.1.0",
|
||||
"private": true,
|
||||
"description": "Helps set up specific MSBuild tool into PATH for later usage.",
|
||||
"main": "lib/main.js",
|
||||
|
40
src/main.ts
40
src/main.ts
@ -9,6 +9,7 @@ const IS_WINDOWS = process.platform === 'win32'
|
||||
const VS_VERSION = core.getInput('vs-version') || 'latest'
|
||||
const VSWHERE_PATH = core.getInput('vswhere-path')
|
||||
const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false'
|
||||
const MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86'
|
||||
|
||||
// if a specific version of VS is requested
|
||||
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest '
|
||||
@ -70,25 +71,38 @@ async function run(): Promise<void> {
|
||||
const installationPath = data.toString().trim()
|
||||
core.debug(`Found installation path: ${installationPath}`)
|
||||
|
||||
let toolPath = path.join(
|
||||
installationPath,
|
||||
'MSBuild\\Current\\Bin\\MSBuild.exe'
|
||||
)
|
||||
|
||||
core.debug(`Checking for path: ${toolPath}`)
|
||||
if (!fs.existsSync(toolPath)) {
|
||||
toolPath = path.join(
|
||||
// x64 only exists in one possible location, so no fallback probing
|
||||
if (MSBUILD_ARCH === "x64") {
|
||||
let toolPath = path.join(
|
||||
installationPath,
|
||||
'MSBuild\\15.0\\Bin\\MSBuild.exe'
|
||||
)
|
||||
|
||||
'MSBuild\\Current\\Bin\\amd64\\MSBuild.exe'
|
||||
);
|
||||
core.debug(`Checking for path: ${toolPath}`)
|
||||
if (!fs.existsSync(toolPath)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
foundToolPath = toolPath
|
||||
} else {
|
||||
let toolPath = path.join(
|
||||
installationPath,
|
||||
'MSBuild\\Current\\Bin\\MSBuild.exe'
|
||||
)
|
||||
|
||||
foundToolPath = toolPath
|
||||
core.debug(`Checking for path: ${toolPath}`)
|
||||
if (!fs.existsSync(toolPath)) {
|
||||
toolPath = path.join(
|
||||
installationPath,
|
||||
'MSBuild\\15.0\\Bin\\MSBuild.exe'
|
||||
)
|
||||
|
||||
core.debug(`Checking for path: ${toolPath}`)
|
||||
if (!fs.existsSync(toolPath)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
foundToolPath = toolPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user