Skip to content

Commit

Permalink
Merge pull request #43 from Microsoft/develop
Browse files Browse the repository at this point in the history
Create new release
  • Loading branch information
heaths authored Mar 15, 2017
2 parents bdd4404 + d2eec55 commit 12c8f71
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
35 changes: 35 additions & 0 deletions docker/Tests/legacy.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,39 @@ Describe 'vswhere -legacy' {
$instances.Count | Should Be 2
}
}

Context 'no instances' {
BeforeEach {
New-Item HKLM:\Software\WOW6432Node\Microsoft\VisualStudio\SxS\VS7 -Force | ForEach-Object {
foreach ($version in '10.0', '14.0') {
$_ | New-ItemProperty -Name $version -Value "C:\VisualStudio\$version" -Force
}
}

Start-Process -Wait -FilePath C:\Windows\SysWOW64\regsvr32.exe -ArgumentList @(
'/s',
'/u',
'C:\Downloads\Microsoft.VisualStudio.Setup.Configuration.Native\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Native.dll'
)
}

AfterEach {
Start-Process -Wait -FilePath C:\Windows\SysWOW64\regsvr32.exe -ArgumentList @(
'/s',
'C:\Downloads\Microsoft.VisualStudio.Setup.Configuration.Native\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Native.dll'
)
}

It 'returns 2 instances' {
$instances = C:\bin\vswhere.exe -legacy -format json | ConvertFrom-Json
$instances.Count | Should Be 2
}

It '-latest returns latest instance' {
$instances = C:\bin\vswhere.exe -legacy -latest -format json | ConvertFrom-Json
$instances.Count | Should Be 1
$instances[0].instanceId | Should Be 'VisualStudio.14.0'
$instances[0].installationPath | Should Be 'C:\VisualStudio\14.0'
}
}
}
4 changes: 2 additions & 2 deletions src/vswhere.lib/Formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Formatter::Formatter()

Formatter::FormatterMap Formatter::Formatters =
{
{ L"json", make_tuple(IDS_FORMAT_TEXT, JsonFormatter::Create) },
{ L"text", make_tuple(IDS_FORMAT_JSON, TextFormatter::Create) },
{ L"json", make_tuple(IDS_FORMAT_JSON, JsonFormatter::Create) },
{ L"text", make_tuple(IDS_FORMAT_TEXT, TextFormatter::Create) },
{ L"value", make_tuple(IDS_FORMAT_VALUE, ValueFormatter::Create) },
{ L"xml", make_tuple(IDS_FORMAT_XML, XmlFormatter::Create) },
};
Expand Down
7 changes: 6 additions & 1 deletion src/vswhere.lib/InstanceSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ InstanceSelector::InstanceSelector(_In_ const CommandArgs& args, _In_ ILegacyPro

bool InstanceSelector::Less(const ISetupInstancePtr& a, const ISetupInstancePtr& b) const
{
static ci_equal equal;
static ci_less less;

bstr_t bstrVersionA, bstrVersionB;
Expand Down Expand Up @@ -62,6 +61,12 @@ bool InstanceSelector::Less(const ISetupInstancePtr& a, const ISetupInstancePtr&
return SUCCEEDED(hrB);
}
}
else
{
// If ISetupHelper is not available we have only legacy products, or very early pre-releases of VS2017.
// For version 10.0 and newer either should lexigraphically sort correctly.
return less(wstring(bstrVersionA), wstring(bstrVersionB));
}
}
else
{
Expand Down

0 comments on commit 12c8f71

Please # to comment.