Skip to content

Commit

Permalink
Add .net6 to targets (#334)
Browse files Browse the repository at this point in the history
Fixes #290
  • Loading branch information
pratiksanglikar authored Jul 15, 2022
1 parent 93d8513 commit 70f528b
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 50 deletions.
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
7 changes: 0 additions & 7 deletions build.cmd

This file was deleted.

5 changes: 3 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $ErrorActionPreference = "Stop"

$LogDirectory = "$PSScriptRoot\buildlogs"
$Solution = "$PSScriptRoot\Microsoft.Extensions.Configuration.AzureAppConfiguration.sln"
$dotnet = & "$PSScriptRoot/build/resolve-dotnet.ps1"

# Create the log directory.
if ((Test-Path -Path $LogDirectory) -ne $true) {
Expand All @@ -28,11 +29,11 @@ if ((Test-Path -Path $LogDirectory) -ne $true) {

if ($RestoreOnly)
{
dotnet restore "$Solution"
& $dotnet restore "$Solution"
}
else
{
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..\%*
18 changes: 0 additions & 18 deletions build/ChoosePowerShell.cmd

This file was deleted.

6 changes: 6 additions & 0 deletions build/install-dotnet.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Installs .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 6.0.301
15 changes: 15 additions & 0 deletions build/resolve-dotnet.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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
7 changes: 0 additions & 7 deletions pack.cmd

This file was deleted.

3 changes: 2 additions & 1 deletion pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ $ErrorActionPreference = "Stop"

$PublishRelativePath = "bin\PackageOutput"
$LogDirectory = "$PSScriptRoot\buildlogs"
$dotnet = & "$PSScriptRoot/build/resolve-dotnet.ps1"

$targetProjects = @(
"Microsoft.Extensions.Configuration.AzureAppConfiguration",
Expand All @@ -33,7 +34,7 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\NugetProperties.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<Description>Microsoft.Azure.AppConfiguration.AspNetCore allows developers to use Microsoft Azure App Configuration service as a configuration source in their applications. This package adds additional features for ASP.NET Core applications to the existing package Microsoft.Extensions.Configuration.AzureAppConfiguration.</Description>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\NugetProperties.props" />

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<Description>Microsoft.Azure.AppConfiguration.Functions.Worker allows developers to use the Microsoft Azure App Configuration service as a configuration source in their applications. This package adds additional features to the existing package Microsoft.Extensions.Configuration.AzureAppConfiguration for .NET Azure Functions running in an isolated process.</Description>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
Expand Down
5 changes: 0 additions & 5 deletions test.cmd

This file was deleted.

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

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

& $dotnet test "$PSScriptRoot\tests\Tests.AzureAppConfiguration\Tests.AzureAppConfiguration.csproj" --logger trx
& $dotnet test "$PSScriptRoot\tests\Tests.AzureAppConfiguration.AspNetCore\Tests.AzureAppConfiguration.AspNetCore.csproj" --logger trx
& $dotnet test "$PSScriptRoot\tests\Tests.AzureAppConfiguration.Functions.Worker\Tests.AzureAppConfiguration.Functions.Worker.csproj" --logger trx

exit $LASTEXITCODE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<DelaySign>false</DelaySign>
<SignAssembly>true</SignAssembly>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<DelaySign>false</DelaySign>
<SignAssembly>true</SignAssembly>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<DelaySign>false</DelaySign>
<SignAssembly>true</SignAssembly>
Expand Down

0 comments on commit 70f528b

Please sign in to comment.