Visual Studio 2015企业脱机安装失败

迈克尔·比科维茨基

我正在尝试评估Visual Studio 2015 Enterprise,但在安装过程中遇到了一些麻烦。这是我所做的:

  1. 使用/layout开关下载完整的安装
  2. 使用/NoWeb开关启动安装

我为此使用了干净的Windows 8.1虚拟机,以免弄乱主机系统。虚拟机未连接到网络。

安装失败,日志中包含以下条目:

MUX:  ExecuteError: Package (VSSecondaryInstaller_box) failed: Error Message Id: 1603 ErrorMessage: Visual Studio Extensibility Item Templates with Assembly References in Nuget Packages : This product did not download successfully: Unable to download 'http://go.microsoft.com/fwlink/?LinkId=558768'.  Web downloads are not allowed when the /NoWeb switch is used.
MUX:  ExecuteError: Package (VSSecondaryInstaller_box) failed: Error Message Id: 1603 ErrorMessage: GitHub Extension for Visual Studio : This product did not download successfully: Unable to download 'http://go.microsoft.com/fwlink/?LinkId=616986'.  Web downloads are not allowed when the /NoWeb switch is used.
MUX:  ExecuteError: Package (VSSecondaryInstaller_box) failed: Error Message Id: 1603 ErrorMessage: PowerShell Tools for Visual Studio : This product did not download successfully: Unable to download 'http://go.microsoft.com/fwlink/?LinkID=616995'.  Web downloads are not allowed when the /NoWeb switch is used.

我注意到这些是安装程序中唯一的VSIX软件包。我当然可以手动安装这些软件包,但我想了解此错误的原因。

有任何想法吗?

迈克尔·比科维茨基

介绍

好吧,一周后,我已经弄清楚了,我有解决方案。请记住,这有点麻烦,并且如果Microsoft决定更新其安装程序,则可能会失败。

但是首先,我们必须了解问题的根源。

问题

正如我在问题中提到的那样,安装日志指出由于/noweb切换,它无法下载VSIX软件包此时的一个合理问题是,为什么安装程序首先尝试下载它们。

要回答这个问题,我们在二次安装程序日志看(dd_vs_enterprise_<timestamp>_SecondaryInstaller_UX.log,里面%temp%目录)。据我了解,辅助安装程序负责安装Visual Studio附带的所有其他程序包。该日志稍微澄清了图片。

DownloadManager Information: 0 : Using cached file at C:\ProgramData\Microsoft\VisualStudioSecondaryInstaller\14.0\installers\VS_Extensibility_TemplatesV1\en\0\Microsoft.Vsix.TemplatesPackage.vsix instead of downloading from http://go.microsoft.com/fwlink/?LinkId=558768
DownloadManager Error: 0 : Signature verification failed on downloaded file. URL: http://go.microsoft.com/fwlink/?LinkId=558768. File location: C:\ProgramData\Microsoft\VisualStudioSecondaryInstaller\14.0\installers\VS_Extensibility_TemplatesV1\en\0\Microsoft.Vsix.TemplatesPackage.vsix. File size: 3965 kb
DownloadManager Error: 0 : BITS download failed. Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Web.PlatformInstaller.InstallManager.BITSDownloadInstallerFile(InstallerContext currentInstall, String& failureReason, String& failureErrorCode, Boolean& downloadNotAllowed, Boolean setFinalReturnState)
DownloadManager Warning: 0 : BITS failure: BITS download failed. BITS service may have been disabled on the machine.. Retrying download for 'Visual Studio Extensibility Item Templates with Assembly References in Nuget Packages'
DownloadManager Warning: 0 : WinInet failure: Unable to download 'http://go.microsoft.com/fwlink/?LinkId=558768'.  Web downloads are not allowed when the /NoWeb switch is used.. Retrying download for 'Visual Studio Extensibility Item Templates with Assembly References in Nuget Packages'
DownloadManager Information: 0 : WebClient downloading file 'http://go.microsoft.com/fwlink/?LinkId=558768' to: C:\Users\John Gallegos\AppData\Local\Temp\evlyeg3i.fmr
DownloadManager Error: 0 : WebClient error while downloading file 'http://go.microsoft.com/fwlink/?LinkId=558768'. Exception: System.Net.WebException: The remote name could not be resolved: 'go.microsoft.com'
   at System.Net.WebClient.OpenRead(Uri address)
   at Microsoft.Web.PlatformInstaller.InstallManager.WebClientDownloadInstallerFile(InstallerContext currentInstall, String& errorMessage, Boolean setFinalReturnState)
DownloadManager Warning: 0 : WebClient failure: The remote name could not be resolved: 'go.microsoft.com'. Retrying download for 'Visual Studio Extensibility Item Templates with Assembly References in Nuget Packages'
DownloadManager Warning: 0 : WinInet failure: Unable to download 'http://go.microsoft.com/fwlink/?LinkId=558768'.  Web downloads are not allowed when the /NoWeb switch is used.. Retrying download for 'Visual Studio Extensibility Item Templates with Assembly References in Nuget Packages'
DownloadManager Error: 0 : BITS failure: Unable to download 'http://go.microsoft.com/fwlink/?LinkId=558768'.  Web downloads are not allowed when the /NoWeb switch is used.. Download failure for Visual Studio Extensibility Item Templates with Assembly References in Nuget Packages.

这还差不多!现在我们知道失败的真正原因是在VSIX上进行签名验证!现在,我们可以重建事件链:

  1. 安装程序尝试验证VSIX上的签名,但失败。
  2. 安装程序将继续从Internet下载VSIX软件包。此处的理由可能是签名验证失败,因为缓存的VSIX已损坏,因此再次下载它是唯一的解决方案。
  3. 当然,安装程序再次失败,因为我们不允许所有下载。

但是有趣的是,在连接到Internet的计算机上,这根本不会发生!即使/noweb指定开关!

寻找答案

即使不允许所有下载,为什么也可以在联网计算机上安装成功?操作系统的信任验证组件似乎无法使用它在本地可用的证书来验证信任时,会转到Internet。

微软有一篇有关VS 2015的已知问题和已修复的错误(在此处的知识库文章,似乎支持了我的理论。文章内容如下:

如果未将Windows Update选项设置为自动更新根证书,而是选择安装可选组件,则在过程结束时会收到以下Visual Studio安装警告:

PowerShell Tools for Visual Studio: This product did not download successfully: Signature verification failed on downloaded file.

如果关闭了自动更新,则您的计算机将没有最新的根证书。因此,Visual Studio安装程序不会将用于对VSIX文件进行签名的证书识别为有效证书,并且不会安装组件。

起初,我以为我找到了想要的东西。我们要做的就是获取正确的证书,并加以使用!但是你怎么做呢?

certmgr.msc在联网计算机上成功安装VS 2015之前和之后安装的证书(使用)的差异提供了一些证书,这些证书似乎是造成我麻烦的原因。但是,在断开连接的计算机上手动安装它们不会产生任何结果。你可以看到我的问题,关于这个问题,但是它对安装没有关系:当我试图在Windows 10上安装同样的事情发生。

也许问题更广泛了?过去,Microsoft提供rootsupd.exe了可以在脱机计算机上安装的根证书更新软件包()。尽管即使在Windows 8.1上也可以安装最新的软件包,但是它不包含我知道所需的证书。因此,我一直在寻找在断开连接的计算机上安装证书更新的替代方法。

Microsoft在TechNet文章中介绍了推荐的方法由于我没有Windows Server计算机,因此尝试手动应用所需的注册表更改,但无济于事。

Visual Studio的论坛并没有提供太多的帮助,无论是。

但是,在突然的清晰中,我对自己想:如果我能完全避免这个问题怎么办?如果我可以尝试用自己的证书替换那些证书,而不是尝试使VSIX上的证书进行验证怎么办?毕竟,我处于断开连接的环境中,因此信任不是问题。

解决方案

可以使用VSIX软件包签名vsixsigntool.exe,可以在此处获得幸运的是,可以将已经签名的VSIX馈送到该实用程序,它将用您指定的证书替换嵌入式证书。一块蛋糕!

好吧,不完全是。这种方法有两个问题:

  1. 证书的主题必须为CN = Microsoft Corporation为什么?安装程序使用特殊的XML“提要”来描述其可用的不同组件(在OfflineCache\feeds目录中查找)。安装VSIX软件包时,它会验证嵌入式证书的主题与XML feed中指定的主题匹配。XML feed也已签名,因此无处不在。
  2. 特殊文件,cache.bin为安装程序提供了查找程序包的缓存版本所需的信息(例如,参见OfflineCache\installers\VS_Extensibility_TemplatesV1\cache.bin)。问题是,该文件包含软件包的SHA256哈希。该文件实际上只是一个序列化的.NET对象,但是我们不能在不访问包含该序列化对象的类及其成员的类的程序集的情况下反序列化它。此外,这不是真正的程序员的工作方式哈希存储为简单的ASCII字符串,因此只需搜索和替换即可。

而已!使用这种方法,我们可以重新签名所有VSIX软件包,将使用的证书导入到“受信任的根证书颁发机构”存储中,而鲍勃是您的叔叔。

代码

我编写了执行上述所有操作的脚本。在这里可用玩得开心!

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章