Find any product with MSBuild component

Fixes #7
This commit is contained in:
Heath Stewart 2020-04-04 11:00:48 -07:00
parent f05df80b32
commit bb70c6a023
5 changed files with 9 additions and 10 deletions

View File

@ -5,7 +5,7 @@ You know how handy that 'Visual Studio Developer Command Prompt' is on your loca
``` ```
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.0 uses: microsoft/setup-msbuild@v1.0.1
``` ```
## Specifying specific versions of Visual Studio ## Specifying specific versions of Visual Studio
@ -13,7 +13,7 @@ You may have a situation where your Actions runner has multiple versions of Visu
``` ```
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.0 uses: microsoft/setup-msbuild@v1.0.1
with: with:
vs-version: [16.4,16.5] vs-version: [16.4,16.5]
``` ```
@ -23,7 +23,7 @@ This makes use of the vswhere tool which is a tool is delivered by Microsoft to
``` ```
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.0 uses: microsoft/setup-msbuild@v1.0.1
with: with:
vswhere-path: 'C:\path\to\your\tools\' vswhere-path: 'C:\path\to\your\tools\'
``` ```

4
dist/index.js vendored
View File

@ -979,7 +979,7 @@ const VS_VERSION = core.getInput('vs-version') || 'latest';
const VSWHERE_PATH = core.getInput('vswhere-path') || const VSWHERE_PATH = core.getInput('vswhere-path') ||
path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio\\Installer'); path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio\\Installer');
// if a specific version of VS is requested // if a specific version of VS is requested
let VSWHERE_EXEC = ''; let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild ';
if (VS_VERSION === 'latest') { if (VS_VERSION === 'latest') {
VSWHERE_EXEC += '-latest '; VSWHERE_EXEC += '-latest ';
} }
@ -987,7 +987,7 @@ else {
VSWHERE_EXEC += `-version ${VS_VERSION} `; VSWHERE_EXEC += `-version ${VS_VERSION} `;
} }
VSWHERE_EXEC += VSWHERE_EXEC +=
'-requires Microsoft.Component.MSBuild -find MSBuild\\**\\Bin\\MSBuild.exe'; '-find MSBuild\\**\\Bin\\MSBuild.exe';
core.debug(`Execution arguments: ${VSWHERE_EXEC}`); core.debug(`Execution arguments: ${VSWHERE_EXEC}`);
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "setup-msbuild", "name": "setup-msbuild",
"version": "1.0.0", "version": "1.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-msbuild", "name": "setup-msbuild",
"version": "1.0.0", "version": "1.0.1",
"private": true, "private": true,
"description": "Helps set up specific MSBuild tool into PATH for later usage.", "description": "Helps set up specific MSBuild tool into PATH for later usage.",
"main": "lib/main.js", "main": "lib/main.js",

View File

@ -14,14 +14,13 @@ const VSWHERE_PATH =
) )
// if a specific version of VS is requested // if a specific version of VS is requested
let VSWHERE_EXEC = '' let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild '
if (VS_VERSION === 'latest') { if (VS_VERSION === 'latest') {
VSWHERE_EXEC += '-latest ' VSWHERE_EXEC += '-latest '
} else { } else {
VSWHERE_EXEC += `-version ${VS_VERSION} ` VSWHERE_EXEC += `-version ${VS_VERSION} `
} }
VSWHERE_EXEC += VSWHERE_EXEC += '-find MSBuild\\**\\Bin\\MSBuild.exe'
'-requires Microsoft.Component.MSBuild -find MSBuild\\**\\Bin\\MSBuild.exe'
core.debug(`Execution arguments: ${VSWHERE_EXEC}`) core.debug(`Execution arguments: ${VSWHERE_EXEC}`)