Skip to content

Use NativeAOT findvcvarsall to find mscv toolchain#218

Merged
AaronRobinsonMSFT merged 7 commits into
AaronRobinsonMSFT:masterfrom
am11:chore/use-nativeaot-helper-for-msvc
Apr 27, 2026
Merged

Use NativeAOT findvcvarsall to find mscv toolchain#218
AaronRobinsonMSFT merged 7 commits into
AaronRobinsonMSFT:masterfrom
am11:chore/use-nativeaot-helper-for-msvc

Conversation

@am11

@am11 am11 commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Related to dotnet/runtime#127414

Switches to use https://github.com/dotnet/runtime/blob/a8f71804178cb4fecd150e45082359dd11d71a76/src/coreclr/nativeaot/BuildIntegration/findvcvarsall.bat with minor difference that we need to capture more than just the compiler path:

% diff -U2 ../runtime/src/coreclr/nativeaot/BuildIntegration/findvcvarsall.bat src/msbuild/findvcvarsall.bat
--- ../runtime/src/coreclr/nativeaot/BuildIntegration/findvcvarsall.bat
+++ src/msbuild/findvcvarsall.bat
@@ -33,14 +33,18 @@
 CALL "%vsBase%\vc\Auxiliary\Build\vcvarsall.bat" %vcEnvironment% > NUL 2> NUL

+IF "%LIB%"=="" GOTO :ERROR
+IF "%INCLUDE%"=="" GOTO :ERROR
+
 FOR /F "delims=" %%W IN ('where link') DO (
-    FOR %%A IN ("%%W") DO ECHO %%~dpA#
-    GOTO :CAPTURE_LIB_PATHS
+    FOR %%A IN ("%%W") DO SET "linkPath=%%~dpA"
+    GOTO :SUCCESS
 )

 GOTO :ERROR

-:CAPTURE_LIB_PATHS
-IF "%LIB%"=="" GOTO :ERROR
-ECHO %LIB%
+:SUCCESS
+
+IF "%linkPath%"=="" GOTO :ERROR
+ECHO %vsBase%#%linkPath%#%LIB%#%INCLUDE%

 ENDLOCAL

Replaces the old VisualStudio.Setup based implementation.

@am11
am11 force-pushed the chore/use-nativeaot-helper-for-msvc branch from 04229fe to ae1ea5d Compare April 27, 2026 13:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot stopped reviewing on behalf of AaronRobinsonMSFT due to an error April 27, 2026 14:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 9

Comment thread src/msbuild/DNNE.BuildTasks/Windows.cs
Comment thread src/msbuild/findvcvarsall.bat
Comment thread src/msbuild/findvcvarsall.bat
Comment thread src/msbuild/findvcvarsall.bat
Comment thread src/msbuild/findvcvarsall.bat
Comment thread src/msbuild/DNNE.BuildTasks/Windows.cs
Comment thread src/msbuild/DNNE.BuildTasks/Windows.cs
Comment thread src/msbuild/DNNE.BuildTasks/DNNE.BuildTasks.csproj Outdated
Comment thread src/msbuild/DNNE.BuildTasks/CreateCompileCommand.cs
am11 and others added 5 commits April 27, 2026 18:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AaronRobinsonMSFT
AaronRobinsonMSFT merged commit 12f3d43 into AaronRobinsonMSFT:master Apr 27, 2026
6 checks passed
@am11
am11 deleted the chore/use-nativeaot-helper-for-msvc branch April 27, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants