Tool information
Area for Triage:
Artifacts
Question, Bug, or Feature?:
Feature
Virtual environments affected
Can this tool be installed during the build?
Not easily
Are you willing to submit a PR?
With guidance on the work required
I see here that the Windows SDK is already installed but RC does not seem to be in the Path when running commands. Is there an environment variable to access binaries installed as part of the Windows SDK?
It turns out the tool is actually there and I was able to reference it by its absolute path at "C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64" RC.exe.
I think an environment variable pointing to the binaries for the most recent version of the SDK in the image would be useful to future proof this.
I think I am running into a related issue. My workflow compiles a C++ extension for a python package and fails in the last step when unable to find RC.exe for linkage.
Here is the link to the failed workflow:
https://github.com/LCAV/pyroomacoustics/runs/400344485
And here is the error message:
2020-01-21T07:44:27.8854075Z Finished generating code
2020-01-21T07:44:28.1471429Z LINK : fatal error LNK1158: cannot run 'rc.exe'
2020-01-21T07:44:28.1774456Z C:\hostedtoolcache\windows\Python\3.5.4\x64\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\a\pyroomacoustics\pyroomacoustics\pyroomacoustics\build_rir.pyx
2020-01-21T07:44:28.1775091Z tree = Parsing.p_module(s, pxd, full_module_name)
2020-01-21T07:44:28.1775769Z error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158
2020-01-21T07:44:28.5229664Z ##[error]Process completed with exit code 1.
2020-01-21T07:44:28.5257501Z Cleaning up orphan processes
Here is what seems to be related issues on stackoverflow:
For Windows Server 2019, adding the following fixed the issue.
echo "::add-path::C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64"
@kyamagu Thank you very much. This fixed the issue for me too.
We can probably add an environment variable that points to the latest SDK.
Hello, @agersant
Visual Studio team doesn't support things being in fixed locations. Running vsdevcmd.bat to set up your dev PATH is what they recommend.
https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt
Workaround is to use the VsDevCmd.bat file sets the appropriate environment variables to enable command-line builds:
function Invoke-VSDevEnvironment {
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
& "${env:COMSPEC}" /s /c "`"$Command`" -no_logo && set" | Foreach-Object {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Example:
jobs:
build:
runs-on: [windows-latest]
steps:
- name: RC.exe
run: |
function Invoke-VSDevEnvironment {
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
& "${env:COMSPEC}" /s /c "`"$Command`" -no_logo && set" | Foreach-Object {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Invoke-VSDevEnvironment
Get-Command rc.exe | Format-Table -AutoSize
GitHub Windows Server 2019:
Azure Devops Windows Server 2016:
Thanks a lot. I wasn't aware of vswhere.exe and this example is very useful.
Most helpful comment
Hello, @agersant
Visual Studio team doesn't support things being in fixed locations. Running vsdevcmd.bat to set up your dev PATH is what they recommend.
https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt
Workaround is to use the VsDevCmd.bat file sets the appropriate environment variables to enable command-line builds:
Example:
GitHub Windows Server 2019:

Azure Devops Windows Server 2016:
