Skip to content

sdk: auto-detect StrideNativeBuildMode#3161

Merged
xen2 merged 1 commit into
stride3d:masterfrom
xen2:sdk/auto-detect-native-build-mode
May 8, 2026
Merged

sdk: auto-detect StrideNativeBuildMode#3161
xen2 merged 1 commit into
stride3d:masterfrom
xen2:sdk/auto-detect-native-build-mode

Conversation

@xen2

@xen2 xen2 commented May 8, 2026

Copy link
Copy Markdown
Member

Pick MSVC only when targeting Windows AND the VS C++ tools are loaded
(VCINSTALLDIR set), Clang otherwise.

  • Plain dotnet build from a regular shell on Windows now works out of the box
  • Cross-compile from Windows host (Linux/Android/iOS targets) auto-uses Clang
  • Drops the now-redundant -p:StrideNativeBuildMode=Clang from many CI workflows (release.yml keeps it, it runs msbuild.exe
    with VS env active)

Note: we'll have to check if MSVC mode is really necessary still at all.

MSVC only when targeting Windows AND the VS C++ tools are loaded in the current shell (VCINSTALLDIR set). Clang everywhere else, including cross-compile from Windows hosts. Removes the need for -p:StrideNativeBuildMode=Clang in 12 CI workflows + test-linux-gpu.ps1 (release.yml keeps the override since it runs msbuild.exe with VS env active).
@xen2 xen2 merged commit b9cebae into stride3d:master May 8, 2026
25 of 26 checks passed
@Kryptos-FR

Kryptos-FR commented May 8, 2026

Copy link
Copy Markdown
Member

@xen2 dotnet build will fail when used from within a Visual Studio Prompt because dotnet is not able to build C++ projects. It still needs to use msbuild.

C:\Projects\Stride\Engine\stride\sources\native\WindowsProjects\WindowsDesktop\WindowsDesktop.vcxproj(35,3): error MSB4278: The imported file "$(VCTargetsPath)\Microsoft.Cpp.Default.props" does not exist and appears to be part of a Visual Studio component. This file may require MSBuild.exe in order to be imported successfully, and so may fail to build in the dotnet CLI.
Stride.Audio net10.0 failed with 10 warning(s) (1.7s)

Still, it is a big improvement because now dotnet build does work from a regular console prompt. We need to update our build documentation to explain this behavior.

@xen2

xen2 commented May 9, 2026

Copy link
Copy Markdown
Member Author

@xen2 dotnet build will fail when used from within a Visual Studio Prompt because dotnet is not able to build C++ projects. It still needs to use msbuild.

C:\Projects\Stride\Engine\stride\sources\native\WindowsProjects\WindowsDesktop\WindowsDesktop.vcxproj(35,3): error MSB4278: The imported file "$(VCTargetsPath)\Microsoft.Cpp.Default.props" does not exist and appears to be part of a Visual Studio component. This file may require MSBuild.exe in order to be imported successfully, and so may fail to build in the dotnet CLI.
Stride.Audio net10.0 failed with 10 warning(s) (1.7s)

Still, it is a big improvement because now dotnet build does work from a regular console prompt. We need to update our build documentation to explain this behavior.

Thanks for the feedback, I reviewed all case and I think the 55b468e should fix those.

I also took the opportunity to simplify top-level README.md build instructions and moved details to another file in 6ee2e04.
This also include a workaround so that even if ARM64 build tools are not installed, it works for local dev. VS with 2 simple workload and everything should work out of the box now! (as soon as we recompile that .NET 6 dependency in deps)

@xen2 xen2 deleted the sdk/auto-detect-native-build-mode branch May 9, 2026 05:58
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.

2 participants