我想知道是否有人设法弄清楚如何安装厨师11安装MSBuildTools 2017(对不起,我落后于时代)。
安装程序: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
一些额外的信息,如果我使用wait命令,它会给出-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 ----
这让我相信它可能正在运行此命令,解压缩所有内容,然后期望再次使用可能相同的命令行窗口(可能不存在于主厨区域中)的另一个调用存在并运行下一个命令
-------------- 更新8/28/2017 ----------------
我切换到使用它,它也没有工作:
vs_buildtools_2017_msbuild_install_zip ='c:/windows/temp/vs_buildtools_2017.zip'
vs_buildtools_2017_msbuild_install_location ='c:/ windows / temp / vs_buildtools_2017'
vs_buildtools_2017_msbuild_installer_dir ='c:/ windows / temp / vs_buildtools_2017 / Installer'
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 ===
-------------- 更新9/6/2017 ----------------
我使用了Chef支持,显然厨师正在安装或者至少使用位于C:\ Program Files \ Microsoft Visual Studio \ Installer中的安装程序文件,而普通安装程序使用Program Files(x86)模拟。
谢谢,
亚历
答案 0 :(得分:0)
更新 - 检查宝石版本
gem 'winrm', '~> 2.0'
gem 'winrm-fs', '~> 1.0'
用于Windows Server 2012r2的配方:
windows_package 'msbuild tools' do
source 'https://aka.ms/vs/15/release/vs_buildtools.exe'
installer_type :custom
action :install
returns [0, 3010]
not_if {::File.exist?('c:\\Program Files (x86)\\Microsoft Visual Studio\\2017\BuildTools\\MSBuild\\15.0\\Bin\\msbuild.exe')}
options '--passive --norestart'
end
我使用Chef 12选项'/passive /norestart'
我将选项更改为'--passive --norestart'
,但确实有效。
答案 1 :(得分:0)
这就是我的工作方式。
# Installs msbuild tools 2017
package_checksum = '{MY CHECKSUM}'
package_source = '{URL TO ARTIFACTORY REPO}/vs_buildtools__730419789.1549921800.exe'
msbuild_location = ::File.join('c:',
'Program Files (x86)',
'Microsoft Visual Studio',
'2017',
'BuildTools',
'MSBuild',
'15.0',
'Bin',
'msbuild.exe')
# Note: Msbuild tools is a pain and a half to update. I currently manually uninstall it before updating because it has a hard time figuring out what it's doing.
command = '--quiet --wait --norestart'\
' --add Microsoft.VisualStudio.Workload.MSBuildTools'\
' --add Microsoft.VisualStudio.Workload.NetCoreBuildTools'
package 'msbuild tools 2017' do
source package_source
checksum package_checksum
installer_type :custom
action :install
returns [0, 3010]
options command
not_if do
::File.exist?(msbuild_location)
end
end