@@ -60,33 +60,47 @@ let install_vc_redist ?(vs_version = "17") ?(arch = `X86_64) () =
6060 |> cleanup
6161
6262let install_visual_studio_build_tools ?(vs_version = " 17" ) components =
63- let install =
64- let fmt =
65- format_of_string
66- {| C :\TEMP \Install. cmd C :\TEMP \vs_buildtools.exe -- quiet -- wait -- norestart -- nocache `
67- -- installPath C :\BuildTools -- channelUri C :\TEMP \VisualStudio. chman `
68- -- installChannelUri C :\TEMP \VisualStudio. chman% s| }
69- in
70- run fmt
71- (List. fold_left
72- (fun acc component -> acc ^ " `\n --add " ^ component)
73- " " components)
63+ (* https://learn.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container?view=vs-2022#dockerfile *)
64+ let excluded_components =
65+ (* Exclude workloads and components with known issues *)
66+ [
67+ " Microsoft.VisualStudio.Component.Windows10SDK.10240" ;
68+ " Microsoft.VisualStudio.Component.Windows10SDK.10586" ;
69+ " Microsoft.VisualStudio.Component.Windows10SDK.14393" ;
70+ " Microsoft.VisualStudio.Component.Windows81SDK" ;
71+ ]
72+ in
73+ let pp cmd components =
74+ let buf = Buffer. create 512 in
75+ List. iter
76+ (fun component ->
77+ Buffer. add_string buf " `\n --" ;
78+ Buffer. add_string buf cmd;
79+ Buffer. add_char buf ' ' ;
80+ Buffer. add_string buf component)
81+ components;
82+ Buffer. contents buf
7483 in
75- (* https://docs.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container?view=vs-2019#install-script *)
7684 add
7785 ~src:
7886 [
87+ (* https://learn.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container?view=vs-2022#install-script *)
7988 " https://raw.githubusercontent.com/ocurrent/ocaml-dockerfile/master/src-opam/Install.cmd" ;
8089 ]
8190 ~dst: {| C :\TEMP \| } ()
8291 @@ add ~src: [ " https://aka.ms/vscollect.exe" ] ~dst: {| C :\TEMP \collect.exe| } ()
8392 @@ add
8493 ~src: [ " https://aka.ms/vs/" ^ vs_version ^ " /release/channel" ]
8594 ~dst: {| C :\TEMP \VisualStudio. chman| } ()
86- @@ add
87- ~src: [ " https://aka.ms/vs/" ^ vs_version ^ " /release/vs_buildtools.exe" ]
88- ~dst: {| C :\TEMP \vs_buildtools.exe| } ()
89- @@ install
95+ @@ run
96+ {| curl - SL -- output C :\TEMP \vs_buildtools.exe https :// aka.ms/ vs/% s/ release/ vs_buildtools.exe `
97+ && (call C :\TEMP \Install .cmd C :\TEMP \vs_buildtools.exe -- quiet -- wait -- norestart -- nocache install `
98+ -- installPath "%%ProgramFiles(x86)%%\Microsoft Visual Studio\202 2\BuildTools" `
99+ -- channelUri C :\TEMP \VisualStudio .chman `
100+ -- installChannelUri C :\TEMP \VisualStudio .chman % s% s) `
101+ && del / q C :\TEMP \vs_buildtools.exe|}
102+ vs_version (pp " add" components)
103+ (pp " remove" excluded_components)
90104
91105let header ~alias ?win10_revision
92106 ?(version =
0 commit comments