1- $root = " $PSScriptRoot \.."
1+ $root = ( Resolve-Path " $PSScriptRoot \.." ).Path
22$artifactsDir = " $root \Artifacts"
3- $nugetOutDir = " $root \Artifacts\NuGet"
4- $testReportDir = " $root \Artifacts\Logs"
5- $testCoverageDir = " $root \Artifacts\Coverage"
6- $nuget = " $root \Tools\NuGet.exe"
3+ $nugetOutDir = " $artifactsDir \NuGet"
4+ $logsDir = " $artifactsDir \Logs"
5+ $testReportDir = " $artifactsDir \TestResults"
6+ $testCoverageDir = " $artifactsDir \Coverage"
7+ $toolsDir = " $root \.tools"
8+
9+ $nuget = " $toolsDir \NuGet.exe"
710$vswhere = " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe"
811$msbuildPath = & $vswhere - latest - products * - requires Microsoft.Component.MSBuild - property installationPath
12+
913if ($msbuildPath ) {
10- $msbuild = join-path $msbuildPath ' MSBuild\Current\Bin\MSBuild.exe'
1114 $msbuildx64 = join-path $msbuildPath ' MSBuild\Current\Bin\amd64\MSBuild.exe'
1215}
1316
@@ -31,13 +34,9 @@ function Update-GeneratedCode {
3134function Start-Build ([boolean ] $IncludeNanoFramework = $false ) {
3235 write-host - foreground blue " Start-Build...`n ---"
3336
34- $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$testReportDir \UnitsNet.msbuild.log"
37+ $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$logsDir \UnitsNet.msbuild.log"
3538
36- $appVeyorLoggerDll = " C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
37- $appVeyorLoggerNetCoreDll = " C:\Program Files\AppVeyor\BuildAgent\dotnetcore\Appveyor.MSBuildLogger.dll"
38- $appVeyorLoggerArg = if (Test-Path " $appVeyorLoggerNetCoreDll " ) { " /logger:$appVeyorLoggerNetCoreDll " } else { " " }
39-
40- dotnet build -- configuration Release / p:ContinuousIntegrationBuild= true " $root \UnitsNet.sln" $fileLoggerArg $appVeyorLoggerArg
39+ dotnet build -- configuration Release / p:ContinuousIntegrationBuild= true " $root \UnitsNet.sln" $fileLoggerArg
4140 if ($lastexitcode -ne 0 ) { exit 1 }
4241
4342 if (-not $IncludeNanoFramework )
@@ -47,13 +46,13 @@ function Start-Build([boolean] $IncludeNanoFramework = $false) {
4746 else
4847 {
4948 write-host - foreground green " Build .NET nanoFramework."
50- $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$testReportDir \UnitsNet.NanoFramework.msbuild.log"
51- $appVeyorLoggerArg = if (Test-Path " $appVeyorLoggerDll " ) { " /logger:$appVeyorLoggerDll " } else { " " }
49+ $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$logsDir \UnitsNet.NanoFramework.msbuild.log"
5250
5351 # msbuild does not auto-restore nugets for this project type
5452 & " $nuget " restore " $root \UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln"
53+
5554 # now build
56- & " $msbuildx64 " " $root \UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" / verbosity:minimal / p:Configuration= Release / p:Platform= " Any CPU" / p:ContinuousIntegrationBuild= true $fileLoggerArg $appVeyorLoggerArg
55+ & " $msbuildx64 " " $root \UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" / verbosity:minimal / p:Configuration= Release / p:Platform= " Any CPU" / p:ContinuousIntegrationBuild= true $fileLoggerArg
5756 if ($lastexitcode -ne 0 ) { exit 1 }
5857 }
5958
@@ -74,7 +73,6 @@ function Start-Tests {
7473 write-host - foreground blue " Run tests...`n ---"
7574 foreach ($projectPath in $projectPaths ) {
7675 $projectFileNameNoEx = [System.IO.Path ]::GetFileNameWithoutExtension($projectPath )
77- $reportFile = " $testReportDir \${projectFileNameNoEx} .xunit.xml"
7876 $coverageReportFile = " $testCoverageDir \${projectFileNameNoEx} .coverage.xml"
7977 $projectDir = [System.IO.Path ]::GetDirectoryName($projectPath )
8078
@@ -84,6 +82,8 @@ function Start-Tests {
8482 # Create coverage report for this test project
8583 & dotnet dotcover test `
8684 -- no- build `
85+ -- logger trx `
86+ -- results- directory " $testReportDir " `
8787 -- dotCoverFilters= " +:module=UnitsNet*;-:module=*Tests" `
8888 -- dotCoverOutput= " $coverageReportFile " `
8989 -- dcReportType= DetailedXML
@@ -93,7 +93,7 @@ function Start-Tests {
9393 }
9494
9595 # Generate a summarized code coverage report for all test projects
96- & " Tools /reportgenerator.exe" - reports:" $root /Artifacts/Coverage/ *.coverage.xml" - targetdir:" $root /Artifacts/Coverage " - reporttypes:HtmlSummary
96+ & " $toolsDir /reportgenerator.exe" - reports:" $testCoverageDir / *.coverage.xml" - targetdir:" $testCoverageDir " - reporttypes:HtmlSummary
9797
9898 write-host - foreground blue " Run tests...END`n "
9999}
0 commit comments