mirror of
https://github.com/freedbygrace/WindowsNotifications.git
synced 2026-08-17 14:17:51 +00:00
Added Unit Tests
This commit is contained in:
@@ -3,42 +3,33 @@
|
||||
# Set the configuration
|
||||
$Configuration = "Release"
|
||||
|
||||
# Find MSBuild
|
||||
$msbuildPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
|
||||
if (-not (Test-Path $msbuildPath)) {
|
||||
$msbuildPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
|
||||
}
|
||||
if (-not (Test-Path $msbuildPath)) {
|
||||
$msbuildPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
|
||||
}
|
||||
if (-not (Test-Path $msbuildPath)) {
|
||||
$msbuildPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
|
||||
}
|
||||
if (-not (Test-Path $msbuildPath)) {
|
||||
# Try to find MSBuild in the PATH
|
||||
$msbuildPath = "MSBuild.exe"
|
||||
# Check if dotnet CLI is available
|
||||
$dotnetPath = Get-Command dotnet -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
|
||||
if (-not $dotnetPath) {
|
||||
Write-Host "The .NET SDK is not installed or not in the PATH. Please install the .NET SDK." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Clean the solution
|
||||
Write-Host "Cleaning solution..." -ForegroundColor Cyan
|
||||
& $msbuildPath WindowsNotifications.sln /t:Clean /p:Configuration=$Configuration
|
||||
dotnet clean WindowsNotifications.sln --configuration $Configuration
|
||||
|
||||
# Restore NuGet packages
|
||||
Write-Host "Restoring NuGet packages..." -ForegroundColor Cyan
|
||||
& $msbuildPath WindowsNotifications.sln /t:Restore /p:Configuration=$Configuration
|
||||
dotnet restore WindowsNotifications.sln
|
||||
|
||||
# Build the solution
|
||||
Write-Host "Building solution..." -ForegroundColor Cyan
|
||||
& $msbuildPath WindowsNotifications.sln /t:Build /p:Configuration=$Configuration
|
||||
dotnet build WindowsNotifications.sln --configuration $Configuration --no-restore
|
||||
|
||||
# Check if the build was successful
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Build completed successfully!" -ForegroundColor Green
|
||||
|
||||
|
||||
# Show the output directory
|
||||
$outputDir = Join-Path -Path $PSScriptRoot -ChildPath "WindowsNotifications\bin\$Configuration"
|
||||
Write-Host "Output directory: $outputDir" -ForegroundColor Yellow
|
||||
|
||||
|
||||
# List the files in the output directory
|
||||
Get-ChildItem -Path $outputDir | Format-Table Name, Length
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user