Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .pipelines/pipeline.user.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@ environment:

restore:
commands:
- !!defaultcommand
name: 'Install .NET'
command: 'build/CallPowerShell.cmd'
arguments: 'build/install-dotnet.ps1 -RestoreOnly'
- !!defaultcommand
name: 'Restore'
command: 'build.cmd'
arguments: '-RestoreOnly'
command: 'build/CallPowerShell.cmd'
arguments: 'build.ps1 -RestoreOnly'

build:
commands:
- !!buildcommand
name: 'Dotnet Build'
command: 'build.cmd'
command: 'build/CallPowerShell.cmd'
arguments: 'build.ps1'
logs:
- from: 'buildlogs'
to: 'Build Logs'
Expand All @@ -32,7 +37,8 @@ package:
commands:
- !!buildcommand
name: 'Dotnet Pack'
command: 'pack.cmd'
command: 'build/CallPowerShell.cmd'
arguments: 'pack.ps1'
logs:
- from: 'buildlogs'
to: 'Build Logs'
Expand All @@ -48,7 +54,8 @@ test:
commands:
- !!testcommand
name: 'Dotnet Test'
command: 'test.cmd'
command: 'build/CallPowerShell.cmd'
arguments: 'test.ps1'
fail_on_stderr: false
testresults:
- title: 'Unit Tests'
Expand Down
8 changes: 0 additions & 8 deletions build.cmd

This file was deleted.

6 changes: 4 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ if ((Test-Path -Path $LogDirectory) -ne $true) {
New-Item -ItemType Directory -Path $LogDirectory | Write-Verbose
}

$dotnet = & "$PSScriptRoot/build/resolve-dotnet.ps1"

if ($RestoreOnly)
{
# Restore
dotnet restore "$Solution"
& $dotnet restore "$Solution"
}
else
{
# Build
dotnet build -c $BuildConfig "$Solution" | Tee-Object -FilePath "$LogDirectory\build.log"
& $dotnet build -c $BuildConfig "$Solution" | Tee-Object -FilePath "$LogDirectory\build.log"
}

exit $LASTEXITCODE
1 change: 1 addition & 0 deletions build/CallPowerShell.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PowerShell %~dp0..\%*
23 changes: 0 additions & 23 deletions build/ChoosePowerShell.cmd

This file was deleted.

8 changes: 8 additions & 0 deletions build/install-dotnet.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Installs .NET Core 2.1 and .NET 6 for CI/CD environment
# see: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script#examples

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;

&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.816

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Version 2.1.816

Why do we need version 2.1.816?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests still build with .NET Core 2.1 for the time being to make sure we exercise the netstandard 2.0 build.


&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1')))
14 changes: 14 additions & 0 deletions build/resolve-dotnet.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Resolves dotnet execution path
# Locations considered include dotnet install script default location and somewhere on path
$CI_CD_INSTALL_PATH = "$env:LOCALAPPDATA\Microsoft\dotnet\dotnet.exe"

if (Test-Path $CI_CD_INSTALL_PATH)
{
$CI_CD_INSTALL_PATH

return
}

$dotnet = Get-Command dotnet.exe -ErrorAction Stop

$dotnet.Source
8 changes: 0 additions & 8 deletions pack.cmd

This file was deleted.

4 changes: 3 additions & 1 deletion pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ if ((Test-Path -Path $LogDirectory) -ne $true) {
New-Item -ItemType Directory -Path $LogDirectory | Write-Verbose
}

$dotnet = & "$PSScriptRoot/build/resolve-dotnet.ps1"

foreach ($project in $targetProjects)
{
$projectPath = "$PSScriptRoot\src\$project\$project.csproj"
$outputPath = "$PSScriptRoot\src\$project\$PublishRelativePath"

dotnet pack -c $BuildConfig -o "$outputPath" "$projectPath" --no-build | Tee-Object -FilePath "$LogDirectory\build.log"
& $dotnet pack -c $BuildConfig -o "$outputPath" "$projectPath" --no-build | Tee-Object -FilePath "$LogDirectory\build.log"
}

exit $LASTEXITCODE
3 changes: 0 additions & 3 deletions test.cmd

This file was deleted.

7 changes: 7 additions & 0 deletions test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$ErrorActionPreference = "Stop"

$dotnet = & "$PSScriptRoot/build/resolve-dotnet.ps1"

& $dotnet test "$PSScriptRoot\tests\Tests.FeatureManagement\Tests.FeatureManagement.csproj" --logger trx

exit $LASTEXITCODE