2017-08-09 2 views
1

Je me demandais si quelqu'un avait réussi à comprendre comment installer MSBuildTools 2017 avec Chef 11 (Je suis désolé, je suis en retard).Installation MSBuildTools 2017 (vs_buildtools) avec le chef

Installer: https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017 (sous Outils de construction pour VS2017)

J'ai essayé deux façons différentes, et les deux semblent juste pour lancer l'exécutable, puis sortir dehors.

J'ai essayé à la fois --quiet et --passive comme commutateurs de ligne de commande et les deux semblent agir exactement la même chose.

Je peux exécuter sur le serveur, et il installe, donc je pense que mon action de ligne de commande est correcte:

vs_buildtools__540411490.1488812665.exe --passive --norestart --add Microsoft.VisualStudio.Workload.MSBuildTools 

L'exécution ressource:

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 

Cela semble fonctionner avec succès , mais finalement, il n'installe pas ce dont j'ai besoin.

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 

La ressource 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 

La sortie en est:

[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 

Un peu d'informations supplémentaires, si j'utilise la commande d'attente, il donne une erreur -200 et fait ceci:

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 ---- 

Ce qui m'amène à croire que peut-être exécuter cette commande, décompresser tout, puis attendre un autre appel en utilisant peut-être la même fenêtre en ligne de commande (qui n'existerait probablement pas en chef) pour exécuter la commande suivante.

-------------- Mise à jour 28/08/2017 ----------------
je commencé à utiliser ce lieu , et il ne fonctionne pas non plus: 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 

Sortie:

[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 === 

-------------- Mise à jour 06/09/2017 ----------------
J'ai pris en charge le chef Chef, et apparemment le chef installe ou à tout le moins en utilisant les fichiers d'installation situés dans C: \ Program Files \ Microsoft Visual Studio \ Installer, tandis que l'installateur normal utilise l'analogue Program Files (x86).

Merci,
Update Alex

Répondre

0

- vérifier les versions de pierres précieuses

gem 'winrm', '~> 2.0' 
gem 'winrm-fs', '~> 1.0' 

Recette utilisée pour 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 

I utilisé Chef de 12 avec des options '/passive /norestart'

J'ai changé t il options à '--passive --norestart' et cela a fonctionné.

+0

Cela ne semble pas fonctionner pour moi :( Peut-être la différence entre le chef 11 et 12? IDK – user1079703