我想知道是否有人設法弄清楚如何讓MSBuildTools 2017與Chef 11一起安裝(對不起,我落後於時代)。與廚師一起安裝MSBuildTools 2017(vs_buildtools)
安裝:https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017(下構建工具VS2017)
我已經試過兩種不同的方式,都似乎只是運行可執行文件,然後退出了。
我試過--quiet和--passive作爲命令行開關,兩者似乎行爲完全一樣。
我可以在服務器上運行它,並將其安裝它,所以我覺得我的命令行操作是正確的:
vs_buildtools__540411490.1488812665.exe --passive --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools
的執行資源:
unless ::File.directory?('C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools')
remote_file vs_buildtools_2017_msbuild_installer do
source 'http://myartifactory.localdomain.com/artifactory/chef/Installers/VisualStudioBuildTools/2017/vs_buildtools__540411490.1488812665.exe'
action :create
end
execute 'Install-VS-BuildTools-2017' do
command "#{vs_buildtools_2017_msbuild_installer} --quiet --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools"
action :run
end
end
這似乎成功運行,但它最終不會安裝我需要的東西。
execute[Install-VS-BuildTools-2017] action run[2017-08-09T11:42:05-04:00] INFO: Processing execute[Install-VS-BuildTools-2017] action run (hps-windows::build_server line 252)
[2017-08-09T11:42:06-04:00] INFO: execute[Install-VS-BuildTools-2017] ran successfully
- execute c:/windows/temp/vs_buildtools__540411490.1488812665.exe --quiet --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools
[2017-08-09T11:42:06-04:00] INFO: Chef Run complete in 65.787128 seconds
的windows_package資源:
windows_package 'Always Run unless the guard says otherwise' do
source 'http://myartifactory.localdomain.com/artifactory/chef/Installers/VisualStudioBuildTools/2017/vs_buildtools__540411490.1488812665.exe'
options '--quiet --wait --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools'
installer_type :custom
action :install
not_if { ::File.directory?('C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools') }
end
這個輸出是:
[2017-08-09T12:26:48-04:00] INFO: remote_file[C:\cygwin\home\Administrator\.chef\local-mode-cache\cache/vs_buildtools__540411490.1488812665.exe] updated file contents C:\cygwin\home\Administrator\.chef\local-mode-cache\cache/vs_buildtools__540411490.1488812665.exe
- update content in file C:\cygwin\home\Administrator\.chef\local-mode-cache\cache/vs_buildtools__540411490.1488812665.exe from e89957 to 68a678
(new content is binary, diff output suppressed)
[2017-08-09T12:26:48-04:00] INFO: Starting installation...this could take awhile.
[2017-08-09T12:26:49-04:00] INFO: Chef Run complete in 65.276391 seconds
的額外信息的比特,如果我使用上述等待命令,它給出了一個錯誤-200並且這麼做:
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '-200'
---- Begin output of c:/windows/temp/vs_buildtools__540411490.1488812665.exe --quiet --wait --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools ----
STDOUT: Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1028\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\2052\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1055\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1046\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1042\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1036\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1029\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\3082\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1040\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1031\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1045\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1041\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1049\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\HelpFile\1033\help.html...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\vs_setup_bootstrapper.exe...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\Microsoft.Diagnostics.Tracing.EventSource.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\Microsoft.VisualStudio.RemoteControl.Net35.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\Microsoft.VisualStudio.Setup.Download.Net35.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\Microsoft.VisualStudio.Telemetry.Net35.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\Microsoft.VisualStudio.Utilities.Internal.Net35.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\Newtonsoft.Json.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\System.Threading.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\zh-Hans\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\cs\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\de\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\es\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\fr\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\it\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\zh-Hant\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\ja\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\ko\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\pl\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\pt-BR\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\ru\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\tr\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\vs_setup_bootstrapper.config...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\vs_setup_bootstrapper.exe.config...
Preparing: C:\Users\Administrator\f3ce1450c1e0b7515b5ec5ed\vs_bootstrapper_d15\vs_setup_bootstrapper.json...
STDERR:
---- End output of c:/windows/temp/vs_buildtools__540411490.1488812665.exe --quiet --wait --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools ----
這導致我相信它可能正在運行這個命令,解包所有內容,然後等待使用可能相同的命令行窗口(可能不會存在於廚師地)存在並運行下一個命令,然後等待另一個調用。
-------------- 更新2017年8月28日 ----------------
我切換到使用這個代替,並沒有工作,要麼: vs_buildtools_2017_msbuild_install_zip = 'C:/windows/temp/vs_buildtools_2017.zip' vs_buildtools_2017_msbuild_install_location = 'C:/窗/溫度/ vs_buildtools_2017' vs_buildtools_2017_msbuild_installer_dir =「C:/窗/溫度/ vs_buildtools_2017 /安裝程序」 vs_buildtools_2017_msbuild_installer = 'C:/windows/temp/vs_buildtools_2017/Installer/vs_installershell.exe'
if ::File.directory?('C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools')
file vs_buildtools_2017_msbuild_install_zip do
action :delete
end
directory vs_buildtools_2017_msbuild_install_location do
action :delete
end
else
remote_file vs_buildtools_2017_msbuild_install_zip do
source 'http://myartifactory.localdomain.com/artifactory/chef/Installers/VisualStudioBuildTools/2017/vs_buildtools_2017.zip'
action :create
end
# Unzip Windows 8.1 SDK
windows_zipfile vs_buildtools_2017_msbuild_install_location do
source vs_buildtools_2017_msbuild_install_zip
action :unzip
not_if { ::File.directory? vs_buildtools_2017_msbuild_install_location }
end
execute 'Install-VS-BuildTools-2017' do
command "#{vs_buildtools_2017_msbuild_installer} --passive --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools"
cwd vs_buildtools_2017_msbuild_installer_dir
action :run
end
end
輸出:
[8/25/2017, 15:59:51] === Logging started: 2017/08/25 15:59:51 ===
[8/25/2017, 15:59:51] Executable: C:\windows\temp\vs_buildtools__540411490.1488812665.exe v15.0.26430.16
[8/25/2017, 15:59:51] --- logging level: standard ---
[8/25/2017, 15:59:51] Directory 'C:\Users\Administrator\7d66710b377678a993285658a9e2\' has been selected for file extraction
[8/25/2017, 15:59:51] Extracting files to: C:\Users\Administrator\7d66710b377678a993285658a9e2\
[8/25/2017, 15:59:51] Extraction took 172 milliseconds
[8/25/2017, 15:59:51] Executing extracted package: 'vs_bootstrapper_d15\vs_setup_bootstrapper.exe ' with commandline ' --passive --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools'
[8/25/2017, 15:59:52] The entire Box execution exiting with result code: 0x0
[8/25/2017, 15:59:52] Launched extracted application exiting with result code: 0x0
[8/25/2017, 15:59:52] === Logging stopped: 2017/08/25 15:59:52 ===
-------------- 更新2017年9月6日 ----------------
我參與了Chef的支持,顯然廚師正在安裝或至少使用位於C:\ Program Files \ Microsoft Visual Studio \ Installer中的安裝程序文件,而普通安裝程序使用Program Files(x86)模擬。
謝謝,
亞歷
這似乎不適合我:( 也許區別廚師11和12? – user1079703