Visual Studio 2019脱机布局更新忽略';--noUpdateInstaller'; [英] Visual Studio 2019 Offline Layout Update ignoring '--noUpdateInstaller'
问题描述
我们使用"Visual Studio Offline Layout"将VS16.6部署到具有混合Internet连接(离线/代理/直接)的开发人员和构建服务器。直到最近,以前VS实例中的installation/update(准确地说是16.3)运行得相当好。
目前,我们不能再使用脱机布局安装本地缓存版本的Visual Studio,因为连接到Internet的计算机需要在安装任何内容之前更新"Visual Studio安装程序"。
调用vs_Professional.exe update --wait --norestart --noweb --noUpdateInstaller ...
后很快失败,退出代码为"1"。
查看temp中的dd_
日志,我们发现:
VisualStudio Bootstrapper:08.06.2020 10:17:49: Starting VS setup process 'vs_installer.exe' with arguments ' --layoutPath "<unc_path>vs2019_250520_layout" --in "<unc_path>vs2019_250520_layoutResponse.json" update --passive --norestart --productkey ;-) --nocache --noUpdateInstaller --noWeb --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.NetCoreTools --add Microsoft.VisualStudio.Workload.Node --add Microsoft.VisualStudio.Component.VC.v141.MFC --includeOptional --includeRecommended --addProductLang en-us --locale de-DE --activityId "2e4fbc9e-37da-4791-9228-11b9649b69fa" --pipe "d549be32-ee39-49d5-b871-bed44625cafb"'.
VisualStudio Bootstrapper:08.06.2020 10:17:49: VS setup process C:Program Files (x86)Microsoft Visual StudioInstallervs_installer.exe started. All done.
VisualStudio Bootstrapper:08.06.2020 10:17:49: Waiting for setup process to complete...
VisualStudio Bootstrapper:08.06.2020 10:17:54: Pipe disconnected.
VisualStudio Bootstrapper:08.06.2020 10:17:56: VS setup process exited with code 1
VisualStudio Bootstrapper:08.06.2020 10:17:56: Bootstrapper failed with client process error or unknown error.
我们在调用Visual Studio安装程序时已经在使用--noweb
and --noUpdateInstaller
标志,这会使我认为这些参数处理不正确。
是否有办法实际强制--noUpdateInstaller
,是否也可以在更新Visual Studio之前脱机更新Visual Installer?
编辑:此问题的可能解决方法可能是确定目标工作站是否连接到Internet,并根据此检查结果指定使用‘--noUpdateInstaller’。
即在我们的部署脚本中:
$hasInternetConnection = try {
$request = [System.Net.WebRequest]::Create( "http://microsoft.com" )
$response = $request.GetResponse()
$response.StatusCode -eq 200
}
catch {
$false
}
# use '--noUpdateInstaller' iff we are not connected to the internet!
$updateInstaller = if ($hasInternetConnection) {
""
}
else {
"--noUpdateInstaller"
}
$packageArgs = @{
packageName = $packageName
fileType = 'EXE'
file = $(Join-Path $layoutPath "vs_Professional.exe")
softwareName = 'Microsoft Visual Studio 2019 Professional'
silentArgs = "$setupPrefix --passive --norestart --wait --productkey $productKey --nocache $updateInstaller --noWeb $selectedWorkloads --includeOptional --includeRecommended --addProductLang en-us"
validExitCodes = @(0, 3010)
}
Install-ChocolateyInstallPackage @packageArgs
推荐答案
遗憾的是,--noUpdateInstaller
开关具有很强的误导性,并且没有完全按照其建议的名称执行操作。
--noUpdateInstaller
以忽略无法检查更新的错误。
create-a-network-installation-of-visual-studio上的提示&q;表示
如果要从非Internet上的脱机源安装 连接的计算机,请同时指定--noweb和--noUpdateInstaller 选项。前者阻止下载更新的工作负载, 组件,等等。后者可防止安装程序 从Web自我更新。
缺少的是,如果有退出代码为"%1"的较新版本的安装程序可用,则命令执行实际上将失败。 这似乎是被设计破坏的,但可以通过对安装/部署/升级脚本进行少量修改来解决。
解决方法1-始终先尝试升级VS_Installer,然后使用脱机布局
(用于将VS部署到主机的示例PowerShell脚本,注意:VS_Professional al.exe是从UNC共享调用的!)
# let the magical vs_installer be updated, if vs has already be installed previously
if (Test-IsVSAlreadyInstalled) {
try {
vs_professional.exe --quiet --update --wait
} catch {
Write-Host "failed to update magical vs_installer"
}
}
# only pass "update" if VS is already installed
$updatePrefix = if (Test-IsVSAlreadyInstalled) { "update" } else { "" }
# install or upgrade visual studio
vs_professional.exe $updatePrefix --passive --norestart --wait --productkey $productKey --noWeb $selectedWorkloads
解决方法#2-如果未连接到Internet,则仅通过--noUpdateInstaller
注意:这将允许vs_installer.exe自我更新,但仅使用脱机布局位置中的vSix包和二进制文件。
(用于将VS部署到主机的示例PowerShell脚本,注意:VS_Professional al.exe是从UNC共享调用的!)
hasInternetConnection = try {
$request = [System.Net.WebRequest]::Create( "http://microsoft.com" )
$response = $request.GetResponse()
$response.StatusCode -eq 200
}
catch {
$false
}
# use '--noUpdateInstaller' iff we are not connected to the internet!
$updateInstaller = if ($hasInternetConnection) {
""
}
else {
"--noUpdateInstaller"
}
# only pass "update" if VS is already installed
$updatePrefix = if (Test-IsVSAlreadyInstalled) { "update" } else { "" }
# install or upgrade visual studio
vs_professional.exe $updatePrefix --passive --norestart --wait --productkey $productKey --nocache $updateInstaller --noWeb $selectedWorkloads
我使用的脚本如解决方法#2中所述,用巧克力包装,目前效果良好。
这篇关于Visual Studio 2019脱机布局更新忽略';--noUpdateInstaller';的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!