visual-studio-2012 - 如何通过命令行检查Visual Studio更新?

标签 visual-studio-2012 updates

为了简化我的虚拟环境设置,我正在使用Chocolatey来自动化我的VM。

由于我可以运行cinst命令来安装Visual Studio

c:\> cinst VisualStudio2012Professional

我想知道是否在安装后是否有命令行开关来检查(然后“安装”)Visual Studio中的更新?

类似于...
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /InstallUpdates

这也应该扩展到VS侧安装的所有扩展。

最佳答案

有一种检查方法,但根本不是直接的方法。 Visual Studio更新是通过当前托管在此处的ATOM提要发布的:

http://go.microsoft.com/fwlink/?LinkID=251032

该URL可以位于:

C:\Program Files(x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Platform\Shell\Microsoft.VisualStudio.ExtensionManager.Implementation.pkgdef

在[$ RootKey $\ExtensionManager\Repositories {52943709-1abb-4abe-b413-41e8bb6d0462}]键下。

对于任何不能保证的Visual Studio BUT版本,以上URL均不应更改。如果检查http://go.microsoft.com/fwlink/?LinkID=290886的响应,则当前将得到以下响应:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text"></title>
  <id>uuid:99B94631-1B1A-45A0-9C34-54F75988DD54;id=1</id>
  <updated>2013-02-12T20:00:00-07:00</updated>  
  <entry>
    <id>8EAF6C8E-1283-4EEE-AB6E-F0F087BFCBFF</id>
    <title type="text">Visual Studio 2012 Update 3</title>
    <summary type="text">Includes security updates, other critical updates, hotfixes, and feature packs that have been issued since the product was released.</summary>
    <published>2012-12-01T21:00:00-07:00</published>
    <updated>2012-12-01T21:00:00-07:00</updated>
    <author>
      <name>Microsoft Corp.</name>
    </author>
    <link rel="alternate" type="text/html" href="http://go.microsoft.com/fwlink/?LinkID=257044&amp;clcid=0x409"/>
    <link rel="releasenotes" type="text/html" href="http://go.microsoft.com/fwlink/?LinkID=257045&amp;clcid=0x409"/>
    <link rel="update" type="text" href="http://go.microsoft.com/fwlink/?LinkID=302339"/>
    <!-- icon should be 32 x 32 pixels -->
    <link rel="icon" type="text" href="http://visualstudiogallery.msdn.microsoft.com/Content/VisualStudio/VSDownload_32x.png"/>
    <!-- preview image should be 200 x 200 pixels -->
    <link rel="previewimage" type="text" href="http://visualstudiogallery.msdn.microsoft.com/Content/VisualStudio/VSDownload_200x.png"/>
    <Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
      <Id>8EAF6C8E-1283-4EEE-AB6E-F0F087BFCBFD</Id>
      <Version>11.0.60610.01</Version>
      <References />
    </Vsix>
  </entry>
  <entry>
    <id>28743233-1A36-4e67-8747-F072F8C76D1F</id>
    <title type="text">Visual Studio Extensions for Windows Library for JavaScript</title>
    <summary type="text">This release updates the development resources for the controls, CSS styles, and helper functions that are included in the Windows Library for JavaScript.</summary>
    <published>2013-08-08T20:00:00-07:00</published>
    <updated>2013-08-08T20:00:00-07:00</updated>
    <author>
      <name>Microsoft Corp.</name>
    </author>
    <link rel="alternate" type="text/html" href="http://go.microsoft.com/fwlink/?LinkId=260891&amp;clcid=0x409"/>
    <link rel="releasenotes" type="text/html" href="http://go.microsoft.com/fwlink/?LinkID=260892&amp;clcid=0x409"/>
    <link rel="update" type="text" href="http://go.microsoft.com/fwlink/?LinkID=260893"/>
    <link rel="icon" type="text" href="http://visualstudiogallery.msdn.microsoft.com/Content/VisualStudio/VSDownload_32x.png"/>
    <link rel="previewimage" type="text" href="http://visualstudiogallery.msdn.microsoft.com/Content/VisualStudio/VSDownload_200x.png"/>
    <Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
      <Id>Microsoft.WinJS</Id>
      <Version>1.0.9200.20789</Version>
      <References />
    </Vsix>
  </entry>
</feed>

请注意,此提要中有两个条目,而您感兴趣的一个条目的标题以“Visual Studio 2012 Update”开头。

如果此文件中指定的版本(此处为11.0.60610.01)大于磁盘上的版本:
(Get-Item "${env:ProgramFiles(x86)}\Microsoft Visual Studio 11.0\common7\ide\devenv.exe").VersionInfo.ProductVersion

然后,您想下载URL并将其安装在Link/@ Update节点中:
<link rel="update" type="text" href="http://go.microsoft.com/fwlink/?LinkID=302339"/>

该网址应重定向到具有更新的MSI。

关于visual-studio-2012 - 如何通过命令行检查Visual Studio更新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18555132/

相关文章:

c++ - Visual Studio C++ 代码格式 - 返回类型 + 类名::函数缩进

c# - MSTest - 如何为 UnitTest 项目初始化 log4net?

c++ - 无法解决 "unexpected end-of-file found"错误

c++ - 为什么 Visual Studio 不将无符号值显示为 int?

ios - Swift:数据库更新后 View Controller 崩溃

updates - 当您有多个服务器版本且每个服务器版本之间存在重大更改时,如何构建自动更新桌面应用程序?

ios - Swift 2.3 在 pod 更新后使用未解析的标识符 Firebase 'FIR'

windows-8 - Visual Studio 2012 Windows 8防火墙上的新Windows存储应用程序错误

Emacs-client - 什么是最小安装?

c# - Entity Framework DbContext 更新值无需查询和外键