|
4 | 4 | <OpenClawVCRuntimePackageVersion>1.0.5</OpenClawVCRuntimePackageVersion> |
5 | 5 | <OpenClawVCRuntimePackageRoot>$(NuGetPackageRoot)vcruntime.cefsharp.140\$(OpenClawVCRuntimePackageVersion)\vc_redist\</OpenClawVCRuntimePackageRoot> |
6 | 6 | <OpenClawVCRuntimeArch Condition="'$(RuntimeIdentifier)' == 'win-x64'">x64</OpenClawVCRuntimeArch> |
| 7 | + <OpenClawVCRuntimeArch Condition="'$(RuntimeIdentifier)' == 'win-arm64'">arm64</OpenClawVCRuntimeArch> |
7 | 8 | </PropertyGroup> |
8 | 9 |
|
9 | | - <ItemGroup Condition="'$(OpenClawVCRuntimeArch)' != ''"> |
10 | | - <OpenClawVCRuntimeFiles Include="$(OpenClawVCRuntimePackageRoot)$(OpenClawVCRuntimeArch)\*.dll" /> |
| 10 | + <!-- |
| 11 | + x64 ships loose VC runtime DLLs sourced from the VCRuntime.CefSharp.140 |
| 12 | + NuGet package, so devs don't need a Visual Studio install to build/publish. |
| 13 | +
|
| 14 | + ARM64 is resolved at publish time from the local Visual Studio install via |
| 15 | + ResolveOpenClawVCRuntimeArm64FromVSInstall — the existing NuGet ships no |
| 16 | + ARM64 binaries and Microsoft does not publish a comparable NuGet for the |
| 17 | + loose ARM64 redist DLLs. |
| 18 | +
|
| 19 | + Local 'dotnet build -r win-arm64' intentionally does NOT require a VS |
| 20 | + install (so cross-compile sanity checks keep working on x64 dev boxes). |
| 21 | + The VS-install requirement only kicks in at publish time, which is what |
| 22 | + the release pipeline actually runs on the windows-11-arm runner. |
| 23 | + --> |
| 24 | + <ItemGroup Condition="'$(OpenClawVCRuntimeArch)' == 'x64'"> |
| 25 | + <OpenClawVCRuntimeFiles Include="$(OpenClawVCRuntimePackageRoot)x64\*.dll" /> |
11 | 26 | </ItemGroup> |
12 | 27 |
|
| 28 | + <Target Name="ResolveOpenClawVCRuntimeArm64FromVSInstall" |
| 29 | + Condition="'$(OpenClawVCRuntimeArch)' == 'arm64'"> |
| 30 | + |
| 31 | + <PropertyGroup> |
| 32 | + <_OpenClawVsWherePath>$(MSBuildProgramFiles32)\Microsoft Visual Studio\Installer\vswhere.exe</_OpenClawVsWherePath> |
| 33 | + </PropertyGroup> |
| 34 | + |
| 35 | + <Error Condition="!Exists('$(_OpenClawVsWherePath)')" |
| 36 | + Text="vswhere.exe not found at '$(_OpenClawVsWherePath)'. Publishing for win-arm64 requires a Visual Studio install with the C++ Redistributable (Microsoft.VisualStudio.Component.VC.Redist.14.Latest) component. Install Visual Studio 2022 or later with that component, or publish for win-x64 instead." /> |
| 37 | + |
| 38 | + <Exec Command=""$(_OpenClawVsWherePath)" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Redist.14.Latest -property installationPath" |
| 39 | + ConsoleToMSBuild="true" |
| 40 | + IgnoreExitCode="true"> |
| 41 | + <Output TaskParameter="ConsoleOutput" PropertyName="_OpenClawVsInstallRoot" /> |
| 42 | + </Exec> |
| 43 | + |
| 44 | + <Error Condition="'$(_OpenClawVsInstallRoot)' == '' or !Exists('$(_OpenClawVsInstallRoot)')" |
| 45 | + Text="vswhere did not find a Visual Studio install with the C++ Redistributable (Microsoft.VisualStudio.Component.VC.Redist.14.Latest) component (got '$(_OpenClawVsInstallRoot)'). Install that component via the Visual Studio Installer (Individual Components tab), or publish for win-x64 instead." /> |
| 46 | + |
| 47 | + <!-- |
| 48 | + Glob the loose CRT DLLs. The Microsoft.VC*.CRT folder name carries the VS |
| 49 | + major version (Microsoft.VC143.CRT for VS 2022, Microsoft.VC145.CRT for |
| 50 | + VS 18). There is at most one Microsoft.VC*.CRT subdir per arch per redist |
| 51 | + version, so the * collapses to a single match. We limit to |
| 52 | + vcruntime140*.dll + msvcp140*.dll to match the file set the x64 NuGet |
| 53 | + ships (concrt140/vccorlib140/vcruntime140_threads aren't needed by |
| 54 | + libsodium and aren't in the x64 payload either). |
| 55 | + --> |
| 56 | + <ItemGroup> |
| 57 | + <OpenClawVCRuntimeFiles Include="$(_OpenClawVsInstallRoot)\VC\Redist\MSVC\*\arm64\Microsoft.VC*.CRT\vcruntime140*.dll" /> |
| 58 | + <OpenClawVCRuntimeFiles Include="$(_OpenClawVsInstallRoot)\VC\Redist\MSVC\*\arm64\Microsoft.VC*.CRT\msvcp140*.dll" /> |
| 59 | + </ItemGroup> |
| 60 | + |
| 61 | + <Error Condition="'@(OpenClawVCRuntimeFiles)' == ''" |
| 62 | + Text="No ARM64 VC++ Runtime DLLs were found under '$(_OpenClawVsInstallRoot)\VC\Redist\MSVC\*\arm64\Microsoft.VC*.CRT\'. Install the 'C++ ARM64/ARM64EC build tools' and 'C++ Redistributable Update' Visual Studio components." /> |
| 63 | + </Target> |
| 64 | + |
13 | 65 | <Target Name="CopyOpenClawVCRuntimeToOutput" |
14 | 66 | AfterTargets="Build" |
15 | | - Condition="'$(OpenClawVCRuntimeArch)' != '' and '@(OpenClawVCRuntimeFiles)' != ''"> |
| 67 | + Condition="'$(OpenClawVCRuntimeArch)' == 'x64' and '@(OpenClawVCRuntimeFiles)' != ''"> |
| 68 | + <!-- |
| 69 | + x64-only on purpose. ARM64 publishes its runtime through the publish-only |
| 70 | + target below so that local 'dotnet build -r win-arm64' does not require |
| 71 | + a Visual Studio install. |
| 72 | + --> |
16 | 73 | <Copy SourceFiles="@(OpenClawVCRuntimeFiles)" |
17 | 74 | DestinationFolder="$(TargetDir)" |
18 | 75 | SkipUnchangedFiles="true" /> |
19 | 76 | </Target> |
20 | 77 |
|
21 | 78 | <Target Name="CopyOpenClawVCRuntimeToPublish" |
22 | 79 | AfterTargets="Publish" |
23 | | - Condition="'$(PublishDir)' != '' and '$(OpenClawVCRuntimeArch)' != '' and '@(OpenClawVCRuntimeFiles)' != ''"> |
| 80 | + DependsOnTargets="ResolveOpenClawVCRuntimeArm64FromVSInstall" |
| 81 | + Condition="'$(PublishDir)' != '' and '$(OpenClawVCRuntimeArch)' != ''"> |
24 | 82 | <Copy SourceFiles="@(OpenClawVCRuntimeFiles)" |
25 | 83 | DestinationFolder="$(PublishDir)" |
26 | 84 | SkipUnchangedFiles="true" /> |
|
0 commit comments