{"id":5857,"date":"2017-03-11T09:37:34","date_gmt":"2017-03-11T01:37:34","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/heaths\/?p=3795"},"modified":"2019-04-17T13:44:24","modified_gmt":"2019-04-17T21:44:24","slug":"vswhere-now-searches-older-versions-of-visual-studio","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/setup\/vswhere-now-searches-older-versions-of-visual-studio\/","title":{"rendered":"vswhere now searches older versions of Visual Studio"},"content":{"rendered":"<p>One of the top requests I kept hearing for <a href=\"https:\/\/github.com\/Microsoft\/vswhere\"><i>vswhere<\/i><\/a> was to also search older versions of Visual Studio. You can now do that starting with the <a href=\"https:\/\/github.com\/Microsoft\/vswhere\/releases\/latest\">latest release<\/a>.<\/p>\n<pre class=\"lang:ps decode:true \">vswhere -legacy -latest -property installationPath<\/pre>\n<p>Even if you don&#8217;t have Visual Studio 2017 or newer installed &#8211; which means the query API is not even registered &#8211; you can use <i>vswhere<\/i> to find the installation root directory for Visual Studio 2010 and newer.<\/p>\n<p>There are some caveats:<\/p>\n<ul>\n<li>You cannot also specify the <code>-products<\/code> or <code>-requires<\/code> parameters.<\/li>\n<li>Information returned is very limited. While there are a few more properties I could scavenge, the scenario that prompted the requests was to find the location.<\/li>\n<\/ul>\n<pre class=\"lang:js decode:true\">[\r\n  {\r\n    \"instanceId\": \"VisualStudio.14.0\",\r\n    \"installationPath\": \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 14.0\\\\\",\r\n    \"installationVersion\": \"14.0\"\r\n  }\r\n]<\/pre>\n<p>All the other <i>vswhere<\/i> parameters that control the output format and selection still work. For example, if you wanted to find the path to the latest version of Visual Studio 2010 through Visual Studio 2014.<\/p>\n<pre class=\"lang:ps decode:true \">$path = vswhere -latest -version '[10.0,15.0)' -property installationPath\r\nif (test-path \"$path\\Common7\\IDE\\devenv.exe\") {\r\n  &amp; $path $args\r\n}<\/pre>\n<p>Once the new version is moderated on <a href=\"https:\/\/chocolatey.org\/packages\/vswhere\">Chocolatey.org<\/a> you can <a href=\"https:\/\/blogs.msdn.microsoft.com\/heaths\/2017\/03\/05\/fast-acquisition-of-vswhere\/\">acquire it quickly<\/a> using <code>choco<\/code> or PowerShell&#8217;s <code>install-package<\/code>.<\/p>\n<p>For rich information about instances, I recommend you use the <a href=\"https:\/\/github.com\/Microsoft\/vssetup.powershell\">VSSetup<\/a> PowerShell module. These support deeper analysis of instances and is designed to work only with Visual Studio 2017 and newer, or related products such as Build Tools.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the top requests I kept hearing for vswhere was to also search older versions of Visual Studio. You can now do that starting with the latest release. vswhere -legacy -latest -property installationPath Even if you don&#8217;t have Visual Studio 2017 or newer installed &#8211; which means the query API is not even registered [&hellip;]<\/p>\n","protected":false},"author":389,"featured_media":3843,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[30,45,46,48,49,52,54,55,56,57],"class_list":["post-5857","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-powershell","tag-visual-studio","tag-vs","tag-vs11","tag-vs15","tag-vs2010","tag-vs2012","tag-vs2013","tag-vs2015","tag-vs2017"],"acf":[],"blog_post_summary":"<p>One of the top requests I kept hearing for vswhere was to also search older versions of Visual Studio. You can now do that starting with the latest release. vswhere -legacy -latest -property installationPath Even if you don&#8217;t have Visual Studio 2017 or newer installed &#8211; which means the query API is not even registered [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/5857","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/users\/389"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/comments?post=5857"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/5857\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media\/3843"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media?parent=5857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/categories?post=5857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/tags?post=5857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}