mirror of
https://github.com/microsoft/setup-msbuild.git
synced 2024-11-10 05:51:07 +07:00
parent
2f9b9c17d6
commit
80d0deb83b
@ -9,15 +9,17 @@ You know how handy that 'Visual Studio Developer Command Prompt' is on your loca
|
||||
```
|
||||
|
||||
## Specifying specific versions of Visual Studio
|
||||
You may have a situation where your Actions runner has multiple versions of Visual Studio and you need to find a specific version of the tool. Simply add the `vs-version` input to specify the range of versions to find. If looking for a specific version, enter that version number twice as a range.
|
||||
You may have a situation where your Actions runner has multiple versions of Visual Studio and you need to find a specific version of the tool. Simply add the `vs-version` input to specify the range of versions to find. If looking for a specific version, specify the minimum and maximum versions as shown in the example below, which will look for just 16.4.
|
||||
|
||||
```
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.0.1
|
||||
with:
|
||||
vs-version: [16.4,16.5]
|
||||
vs-version: [16.4,16.5)
|
||||
```
|
||||
|
||||
The syntax is the same used for Visual Studio extensions, where square brackets like "[" mean inclusive, and parenthesis like "(" mean exclusive. A comma is always required, but eliding the minimum version looks for all older versions and eliding the maximum version looks for all newer versions. See the [vswhere wiki](https://github.com/microsoft/vswhere/wiki) for more details.
|
||||
|
||||
## How does this work?
|
||||
This makes use of the vswhere tool which is a tool is delivered by Microsoft to help in identifying Visual Studio installs and various components. This tool is installed on the hosted Windows runners for GitHub Actions. If you are using a self-hosted runner, you either need to make sure vswhere.exe is in your agent's PATH or specify a full path to the location using:
|
||||
|
||||
|
7
dist/index.js
vendored
7
dist/index.js
vendored
@ -980,11 +980,8 @@ const VS_VERSION = core.getInput('vs-version') || 'latest';
|
||||
const VSWHERE_PATH = core.getInput('vswhere-path') ||
|
||||
path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio\\Installer');
|
||||
// if a specific version of VS is requested
|
||||
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath ';
|
||||
if (VS_VERSION === 'latest') {
|
||||
VSWHERE_EXEC += '-latest ';
|
||||
}
|
||||
else {
|
||||
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest ';
|
||||
if (VS_VERSION !== 'latest') {
|
||||
VSWHERE_EXEC += `-version "${VS_VERSION}" `;
|
||||
}
|
||||
core.debug(`Execution arguments: ${VSWHERE_EXEC}`);
|
||||
|
@ -15,11 +15,8 @@ const VSWHERE_PATH =
|
||||
)
|
||||
|
||||
// if a specific version of VS is requested
|
||||
let VSWHERE_EXEC =
|
||||
'-products * -requires Microsoft.Component.MSBuild -property installationPath '
|
||||
if (VS_VERSION === 'latest') {
|
||||
VSWHERE_EXEC += '-latest '
|
||||
} else {
|
||||
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest '
|
||||
if (VS_VERSION !== 'latest') {
|
||||
VSWHERE_EXEC += `-version "${VS_VERSION}" `
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user