setup-dotnet/__tests__/verify-dotnet.ps1
Patreos98 a6fda504d5 Revert "Merge branch 'main' into dependabot/npm_and_yarn/node-fetch-2.6.1"
This reverts commit b8c9c25ab1d423e5c3aefb3903399a6c1b64bae3, reversing
changes made to 19ffec8f3e520e1f08af6a7583b84852f6e6f0fe.
2020-09-20 18:11:25 +02:00

38 lines
931 B
PowerShell
Executable File

if (!$args[0])
{
throw "Must supply dotnet version argument"
}
if (-Not (Test-Path "../nuget.config"))
{
throw "nuget file not generated correctly"
}
$dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path }
Write-Host "Found '$dotnet'"
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
Write-Host "Version $version"
# if ($version -ne $args[0])
# {
# Write-Host "PATH='$env:path'"
# Write-Host "gcm dotnet:"
# gcm dotnet | fl
# throw "Unexpected version"
# }
Write-Host "Building sample csproj"
& $dotnet build __tests__/sample-csproj/ --no-cache
if ($LASTEXITCODE -ne 0)
{
throw "Unexpected exit code $LASTEXITCODE"
}
Write-Host "Testing compiled app"
$sample_output = "$(__tests__/sample-csproj/bin/Debug/netcoreapp3.0/sample.exe)".Trim()
Write-Host "Sample output: $sample_output"
if ($sample_output -notlike "*Hello*World*")
{
throw "Unexpected output"
}