Skip to content

Commit

Permalink
Merge pull request #69 from microsoft/net9
Browse files Browse the repository at this point in the history
Updated to .Net 9.
  • Loading branch information
azchohfi authored Nov 13, 2024
2 parents 892abce + 4b2fc12 commit d7819da
Show file tree
Hide file tree
Showing 117 changed files with 881 additions and 1,422 deletions.
13 changes: 11 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ dotnet_diagnostic.IDE0046.severity = suggestion
dotnet_diagnostic.IDE0052.severity = warning

# IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = suggestion
dotnet_diagnostic.IDE0058.severity = none

# IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0060.severity = warning
Expand All @@ -434,4 +434,13 @@ dotnet_diagnostic.IDE0005.severity = warning

# IDE0073: File header
dotnet_diagnostic.IDE0073.severity = warning
file_header_template = Copyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the MIT License.
file_header_template = Copyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the MIT License.

# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = suggestion

# SA1513: Closing brace should be followed by blank line
dotnet_diagnostic.SA1513.severity = none

# SA1010: Opening square brackets should be spaced correctly
dotnet_diagnostic.SA1010.severity = none
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Install and Configure Keyring
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
Expand All @@ -42,11 +42,11 @@ jobs:
run: dotnet restore MSStore.CLI.sln /p:Configuration=Release
- name: Build
run: dotnet build MSStore.CLI.sln --no-restore /p:Configuration=Release
- name: Test net8.0
run: dotnet run --project MSStore.CLI.UnitTests -f net8.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
- name: Test net8.0-windows10.0.17763.0
- name: Test net9.0
run: dotnet run --project MSStore.CLI.UnitTests -f net9.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
- name: Test net9.0-windows10.0.17763.0
if: ${{ matrix.os == 'windows-latest' }}
run: dotnet run --project MSStore.CLI.UnitTests -f net8.0-windows10.0.17763.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
run: dotnet run --project MSStore.CLI.UnitTests -f net9.0-windows10.0.17763.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
- name: Publish test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -83,13 +83,13 @@ jobs:
include:
- os: windows-latest
dotnet-os: win
dotnet-framework: net8.0-windows10.0.17763.0
dotnet-framework: net9.0-windows10.0.17763.0
- os: ubuntu-latest
dotnet-os: linux
dotnet-framework: net8.0
dotnet-framework: net9.0
- os: macos-latest
dotnet-os: osx
dotnet-framework: net8.0
dotnet-framework: net9.0
runs-on: ${{ matrix.os }}

name: Build CLI - ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}
Expand All @@ -101,7 +101,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest' }}
uses: microsoft/setup-msbuild@v2
Expand Down
6 changes: 3 additions & 3 deletions .pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extends:
credscan:
suppressionsFile: '$(System.DefaultWorkingDirectory)/.pipelines/CredScanSuppressions.json'
binSkim:
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net8.0\MSStore.API.dll'
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net9.0\MSStore.API.dll'
stages:
- stage: Build_And_Run_CodeQL
jobs:
Expand All @@ -63,9 +63,9 @@ extends:
steps:
- checkout: self
- task: UseDotNet@2
displayName: Setup .NET 8
displayName: Setup .NET 9
inputs:
version: 8.0.x
version: 9.0.x
- script: mv -f $(Build.SourcesDirectory)/.pipelines/release-nuget.config ./nuget.config
displayName: Add release package source
- task: NuGetAuthenticate@1
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/code-inspector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extends:
credscan:
suppressionsFile: '$(System.DefaultWorkingDirectory)/.pipelines/CredScanSuppressions.json'
binSkim:
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net8.0\MSStore.API.dll'
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net9.0\MSStore.API.dll'
stages:
- stage: codeInspector
displayName: Code Inspector
Expand Down
16 changes: 8 additions & 8 deletions .pipelines/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ parameters:
image: windows-latest
os: windows
dotnet_runtime: win
dotnet_framework: net8.0-windows10.0.17763.0
dotnet_framework: net9.0-windows10.0.17763.0
- name: Azure-Pipelines-1ESPT-ExDShared
image: ubuntu-latest
os: linux
dotnet_runtime: linux
dotnet_framework: net8.0
dotnet_framework: net9.0
- name: Azure Pipelines
image: macos-latest
os: macOS
dotnet_runtime: osx
dotnet_framework: net8.0
dotnet_framework: net9.0

name: 0.0.$(Date:yyMM).$(Date:dd)$(Rev:rr)

Expand All @@ -69,7 +69,7 @@ extends:
credscan:
suppressionsFile: '$(System.DefaultWorkingDirectory)/.pipelines/CredScanSuppressions.json'
binSkim:
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net8.0\MSStore.API.dll'
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\**\net9.0\MSStore.API.dll'
stages:
- stage: NuGet
jobs:
Expand All @@ -84,9 +84,9 @@ extends:
steps:
- checkout: self
- task: UseDotNet@2
displayName: Setup .NET 8
displayName: Setup .NET 9
inputs:
version: 8.0.x
version: 9.0.x
- ${{ if eq(parameters.DoEsrp, 'true') }}:
- task: UseDotNet@2
displayName: Setup .NET 6.0 (For ESRP Task)
Expand Down Expand Up @@ -128,9 +128,9 @@ extends:
- checkout: self
persistCredentials: true
- task: UseDotNet@2
displayName: Setup .NET 8
displayName: Setup .NET 9
inputs:
version: 8.0.x
version: 9.0.x
- ${{ if eq(parameters.DoEsrp, 'true') }}:
- task: UseDotNet@2
displayName: Setup .NET 6.0 (For ESRP Task)
Expand Down
10 changes: 5 additions & 5 deletions .pipelines/templates/build-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ steps:
- script: dotnet build MSStore.CLI.sln --no-restore /p:Configuration=${{ parameters.dotnet_configuration }}
displayName: Build
- task: DotNetCoreCLI@2
displayName: 'Tests net8.0'
displayName: 'Tests net9.0'
env:
DISPLAY: :0.0
inputs:
command: 'run'
projects: '**/*[Tt]est*/*.csproj'
arguments: '-f net8.0 --no-build -c ${{ parameters.dotnet_configuration }} --coverage --coverage-output-format cobertura --report-trx'
arguments: '-f net9.0 --no-build -c ${{ parameters.dotnet_configuration }} --coverage --coverage-output-format cobertura --report-trx'
- task: DotNetCoreCLI@2
displayName: 'Tests net8.0-windows10.0.17763.0'
displayName: 'Tests net9.0-windows10.0.17763.0'
condition: startsWith(variables.AgentOS, 'Windows_NT')
env:
DISPLAY: :0.0
inputs:
command: 'run'
projects: '**/*[Tt]est*/*.csproj'
arguments: '-f net8.0-windows10.0.17763.0 --no-build -c ${{ parameters.dotnet_configuration }} --coverage --coverage-output-format cobertura --report-trx'
arguments: '-f net9.0-windows10.0.17763.0 --no-build -c ${{ parameters.dotnet_configuration }} --coverage --coverage-output-format cobertura --report-trx'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
Expand Down Expand Up @@ -85,7 +85,7 @@ steps:
AuthAKVName: ${{ parameters.signingIdentity.akvName }}
AuthCertName: ${{ parameters.signingIdentity.authCertName }}
AuthSignCertName: ${{ parameters.signingIdentity.signCertName }}
FolderPath: '$(System.DefaultWorkingDirectory)/MSStore.API/bin/${{ parameters.dotnet_configuration }}/net8.0'
FolderPath: '$(System.DefaultWorkingDirectory)/MSStore.API/bin/${{ parameters.dotnet_configuration }}/net9.0'
Pattern: 'MSStore.API.dll'
signConfigType: inlineSignParams
inlineOperation: |
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/templates/pack-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ steps:
displayName: 'Copy Artifacts - NuGet DLLs'
condition: startsWith(variables.AgentOS, 'Linux')
inputs:
contents: '$(System.DefaultWorkingDirectory)/MSStore.API/bin/${{ parameters.dotnet_configuration }}/net8.0/*'
contents: '$(System.DefaultWorkingDirectory)/MSStore.API/bin/${{ parameters.dotnet_configuration }}/net9.0/*'
flattenFolders: true
targetFolder: '$(Build.ArtifactStagingDirectory)/NuGetDLLs'
- task: 1ES.PublishPipelineArtifact@1
Expand Down
3 changes: 0 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
<RunSettingsFilePath>$(MSBuildThisFileDirectory)\.runsettings</RunSettingsFilePath>
<Nullable>enable</Nullable>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<NoWarn>$(NoWarn);SA0001</NoWarn>
<!-- IL Trimming, until System.CommandLine.Hosting supports it -->
<NoWarn>$(NoWarn);IL2077;IL2080;IL2075</NoWarn>
<!-- BROKEN: IL Trimming, until Microsoft.Identity.Client supports it, just so it builds --><!--
<NoWarn>$(NoWarn);IL2026;IL2046;IL2055;IL2057;IL2060;IL2062;IL2065;IL2067;IL2070;IL2072</NoWarn>-->
</PropertyGroup>
Expand Down
11 changes: 5 additions & 6 deletions MSStore.API/MSStore.API.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<!-- TODO: Fully enable docs -->
<NoWarn>$(NoWarn);CS1591</NoWarn>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand All @@ -11,8 +11,7 @@
<PackageTags>Microsoft Store;MSStoreAPI;MSStore;API</PackageTags>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<!--<IsAotCompatible>true</IsAotCompatible>-->
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand All @@ -22,9 +21,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.66.1" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.66.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.66.2" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.66.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
</ItemGroup>

</Project>
9 changes: 2 additions & 7 deletions MSStore.API/MSStoreHttpException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@

namespace MSStore.API
{
public class MSStoreHttpException : MSStoreException
public class MSStoreHttpException(HttpResponseMessage response) : MSStoreException
{
public HttpResponseMessage Response { get; private set; }

public MSStoreHttpException(HttpResponseMessage response)
{
Response = response;
}
public HttpResponseMessage Response { get; private set; } = response;
}
}
4 changes: 2 additions & 2 deletions MSStore.API/MSStoreWrappedErrorException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public class MSStoreWrappedErrorException : MSStoreException
public MSStoreWrappedErrorException(string? message, List<ResponseError>? responseErrors)
: base(message)
{
ResponseErrors = responseErrors ?? new List<ResponseError>();
ResponseErrors = responseErrors ?? [];
}

public MSStoreWrappedErrorException(string? message, List<ResponseError>? responseErrors, Exception? innerException)
: base(message, innerException)
{
ResponseErrors = responseErrors ?? new List<ResponseError>();
ResponseErrors = responseErrors ?? [];
}
}
}
13 changes: 1 addition & 12 deletions MSStore.API/Models/ResponseWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,9 @@

namespace MSStore.API.Models
{
public class ResponseWrapper<T>
public class ResponseWrapper
{
public T? ResponseData { get; set; }
public bool IsSuccess { get; set; }
public List<ResponseError>? Errors { get; set; }

public static implicit operator ResponseWrapper<object>(ResponseWrapper<T> v)
{
return new()
{
Errors = v.Errors,
IsSuccess = v.IsSuccess,
ResponseData = v.ResponseData
};
}
}
}
20 changes: 20 additions & 0 deletions MSStore.API/Models/ResponseWrapper{T}.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace MSStore.API.Models
{
public class ResponseWrapper<T> : ResponseWrapper
{
public T? ResponseData { get; set; }

public static implicit operator ResponseWrapper<object>(ResponseWrapper<T> v)
{
return new()
{
Errors = v.Errors,
IsSuccess = v.IsSuccess,
ResponseData = v.ResponseData
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static List<ApplicationPackage> FilterUnsupported(this List<ApplicationPa
{
if (applicationPackages == null)
{
return new List<ApplicationPackage>();
return [];
}

return applicationPackages.Where(p =>
Expand Down
Loading

0 comments on commit d7819da

Please sign in to comment.