build-new.ps1 723 B

123456789101112131415161718192021222324
  1. $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
  2. $msbuild = Get-ItemProperty "hklm:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0"
  3. # TODO: if not found, bail out
  4. $msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"
  5. Write-Host "Restoring packages" -Foreground Green
  6. dotnet restore $scriptPath | out-null
  7. Write-Host "Building projects" -Foreground Green
  8. $projects = gci $scriptPath -Directory `
  9. | Where-Object { Test-Path (Join-Path $_.FullName "project.json") } `
  10. | Select -ExpandProperty FullName
  11. foreach ($project in $projects) {
  12. dotnet build $project
  13. }
  14. Write-Host "Running tests" -Foreground Green
  15. $testDirectory = Join-Path $scriptPath "Tests"
  16. cd $testDirectory
  17. dotnet test