Automatic tests now support Visual Studio 2017

This commit is contained in:
Michael Grafnetter 2017-03-09 01:29:56 +01:00
parent d6152ccf44
commit 2be881706a
5 changed files with 21 additions and 9 deletions

View File

@ -14,7 +14,7 @@ $modulePath = Join-Path $PSScriptRoot 'Modules\Invoke-MSBuild'
Import-Module $modulePath -ErrorAction Stop
$targets = 'Build' # 'Clean'
$configurations = 'Release' # 'Debug'
$configurations = 'Release', 'Debug'
$platforms = 'x86','x64'
# Delete the entire Build directory

View File

@ -313,7 +313,7 @@ function Get-VisualStudioCommandPromptPath
$vs2015CommandPrompt = $env:VS140COMNTOOLS + "VsDevCmd.bat"
# We have to use the vswhere.exe tool to locate Visual Studio 2017
$vsWhere = Join-Path $PSScriptRoot vswhere.exe
$vsWhere = Join-Path $PSScriptRoot '..\..\Tools\vswhere.exe'
$vs2017Instance = & $vsWhere -nologo -format value -property installationPath -latest -requires 'Microsoft.VisualStudio.Component.VC.CLI.Support'
$vs2017CommandPrompt = Join-Path $vs2017Instance 'Common7\Tools\VsDevCmd.bat'

View File

@ -365,7 +365,7 @@ function Get-MsTest
#>
$MsTest = "$(Get-VsCommonTools)..\IDE\MsTest.exe"
$MsTest = Join-Path (Get-VsCommonTools) '..\IDE\MsTest.exe'
if (Test-Path $MsTest) {$MsTest}
else {Write-Error "Unable to find MsTest.exe"}
}
@ -382,9 +382,22 @@ function Get-VsCommonTools
to satisfy your needs.
#>
$VsCommonToolsPaths = @(@($env:VS140COMNTOOLS,$env:VS120COMNTOOLS,$env:VS110COMNTOOLS,$env:VS100COMNTOOLS) | Where-Object {$_ -ne $null})
if ($VsCommonToolsPaths.Count -ne 0) {$VsCommonToolsPaths[0]}
else {Write-Error "Unable to find Visual Studio Common Tool Path."}
# We have to use the vswhere.exe tool to locate Visual Studio 2017
$vsWhere = Join-Path $PSScriptRoot '..\..\Tools\vswhere.exe'
$vs141Instance = & $vsWhere -nologo -format value -property installationPath -latest -requires 'Microsoft.VisualStudio.Component.VC.CLI.Support'
$VS141COMNTOOLS = Join-Path $vs141Instance 'Common7\Tools'
# Now test which VS versions are present on the system
$VsCommonToolsPath = @($VS141COMNTOOLS,$env:VS140COMNTOOLS,$env:VS120COMNTOOLS,$env:VS110COMNTOOLS,$env:VS100COMNTOOLS) |
Where-Object { $_ -ne $null -and (Test-Path -Path $_ -PathType Container) } |
Select-Object -First 1
if ($VsCommonToolsPath -eq $null)
{
Write-Error "Unable to find Visual Studio Common Tool Path."
}
return $VsCommonToolsPath
}
################################################################################
Export-ModuleMember -Function Invoke-MsTest,Get-MsTest

View File

@ -21,7 +21,6 @@ mkdir $resultsDir -Force | Out-Null
# Execute all Visual Studio Unit Tests
Get-ChildItem -Path $buildDir -Filter *.Test.dll -File -Recurse | foreach {
$unitTestFile = $_.FullName
#Split-Path $_.Name -
$resultsFile = Join-Path $resultsDir ($_.BaseName + '.trx')
& $msTest /testcontainer:$unitTestFile /resultsfile:$resultsFile /runconfig:$runConfig
}