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.

10 changes: 10 additions & 0 deletions build/install-dotnet.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Installs .NET Core 2.1, .NET 5 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

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

&([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
6 changes: 3 additions & 3 deletions examples/ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Consoto.Banking.AccountService</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/FeatureFlagDemo/FeatureFlagDemo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions examples/TargetingConsoleApp/TargetingConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Consoto.Banking.AccountService</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Import Project="..\..\build\Versioning.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>..\..\build\Microsoft.FeatureManagement.snk</AssemblyOriginatorKeyFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Import Project="..\..\build\Versioning.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>..\..\build\Microsoft.FeatureManagement.snk</AssemblyOriginatorKeyFile>
Expand Down
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
2 changes: 1 addition & 1 deletion tests/Tests.FeatureManagement/FeatureManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ public async Task ThreadsafeSnapshot()

private static void DisableEndpointRouting(MvcOptions options)
{
#if NET5_0 || NETCOREAPP3_1
#if NET6_0 || NET5_0 || NETCOREAPP3_1
//
// Endpoint routing is disabled by default in .NET Core 2.1 since it didn't exist.
options.EnableEndpointRouting = false;
Expand Down
8 changes: 7 additions & 1 deletion tests/Tests.FeatureManagement/Tests.FeatureManagement.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
Expand Down Expand Up @@ -31,6 +31,12 @@
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.FeatureManagement.AspNetCore\Microsoft.FeatureManagement.AspNetCore.csproj" />
</ItemGroup>
Expand Down