Skip to content

Commit 7d2d71a

Browse files
Copilottrask
andcommitted
Fix Visual Studio path detection for windows-latest CI runners
Co-authored-by: trask <[email protected]>
1 parent 6bf53cb commit 7d2d71a

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.github/workflows/build-common.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ jobs:
103103
- name: Setup Gradle
104104
uses: gradle/actions/setup-gradle@v4
105105

106+
- name: Add MSBuild to PATH
107+
uses: microsoft/setup-msbuild@v2
108+
106109
- name: Assemble
107110
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
108111
run: >

etw/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The build should find the tools and Windows SDK, but if needed these environment
1818
* Default: `"%ProgramFiles(x86)%/Windows Kits/10"`
1919
* `APPINSIGHTS_VS_PATH`
2020
* Location of Visual Studio Build Tools
21-
* Default: `%ProgramFiles(x86)%/Microsoft Visual Studio/2022/BuildTools`
21+
* Default: `%ProgramFiles(x86)%/Microsoft Visual Studio/2022/Enterprise`
2222
* `APPINSIGHTS_WIN_SDK_LIB_PATH`
2323
* Location of Windows 10 SDK library folder (for linker requirements)
2424
* Default: `%APPINSIGHTS_WIN10_SDK_PATH%/Lib/10.0.18362.0/um`

etw/native/build.gradle

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,29 @@ if (System.env.APPINSIGHTS_WIN10_SDK_PATH) {
1313
winSdkDir = System.env.APPINSIGHTS_WIN10_SDK_PATH
1414
logger.info "Windows SDK path set with environment variable, APPINSIGHTS_WIN10_SDK_PATH"
1515
}
16-
def vsToolsDir = "$programFilesX86/Microsoft Visual Studio/2022/BuildTools"
16+
// Find Visual Studio installation
17+
def vsToolsDir = "$programFilesX86/Microsoft Visual Studio/2022/Enterprise"
18+
19+
// Check for alternative locations on GitHub Actions
20+
if (!new File(vsToolsDir).exists()) {
21+
def alternativePaths = [
22+
"C:/Program Files/Microsoft Visual Studio/2022/Enterprise",
23+
"$programFilesX86/Microsoft Visual Studio/2022/Professional",
24+
"C:/Program Files/Microsoft Visual Studio/2022/Professional",
25+
"$programFilesX86/Microsoft Visual Studio/2022/Community",
26+
"C:/Program Files/Microsoft Visual Studio/2022/Community",
27+
"$programFilesX86/Microsoft Visual Studio/2022/BuildTools",
28+
"C:/Program Files/Microsoft Visual Studio/2022/BuildTools"
29+
]
30+
31+
for (def path : alternativePaths) {
32+
if (new File(path).exists()) {
33+
vsToolsDir = path
34+
break
35+
}
36+
}
37+
}
38+
1739
if (System.env.APPINSIGHTS_VS_PATH) {
1840
vsToolsDir = System.env.APPINSIGHTS_VS_PATH
1941
logger.info "Visual Studio Build Tools path set with environment variable, APPINSIGHTS_VS_PATH"

0 commit comments

Comments
 (0)