Skip to content

Commit

Permalink
Updated to net8.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
azchohfi committed Nov 15, 2023
1 parent 59d483c commit 0d63e72
Show file tree
Hide file tree
Showing 30 changed files with 107 additions and 94 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ dotnet_diagnostic.CA1812.severity = warning
dotnet_diagnostic.CA1821.severity = warning
dotnet_diagnostic.CA1823.severity = warning
dotnet_diagnostic.CA1848.severity = suggestion
dotnet_diagnostic.CA1861.severity = suggestion
dotnet_diagnostic.CA1900.severity = warning
dotnet_diagnostic.CA1901.severity = warning
dotnet_diagnostic.CA2002.severity = warning
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Install and Configure Keyring
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
Expand Down Expand Up @@ -90,13 +90,13 @@ jobs:
include:
- os: windows-latest
dotnet-os: win
dotnet-framework: net7.0-windows10.0.17763.0
dotnet-framework: net8.0-windows10.0.17763.0
- os: ubuntu-latest
dotnet-os: linux
dotnet-framework: net7.0
dotnet-framework: net8.0
- os: macos-latest
dotnet-os: osx.12
dotnet-framework: net7.0
dotnet-framework: net8.0
runs-on: ${{ matrix.os }}

name: Build CLI - ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}
Expand All @@ -108,7 +108,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest' }}
uses: microsoft/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- task: UseDotNet@2
displayName: Setup .NET 7
inputs:
version: 7.0.x
version: 8.0.x
- script: mv -f ./.pipelines/release-nuget.config ./nuget.config
displayName: Add release package source
- task: NuGetAuthenticate@0
Expand Down
12 changes: 6 additions & 6 deletions .pipelines/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ stages:
- task: UseDotNet@2
displayName: Setup .NET 7
inputs:
version: 7.0.x
version: 8.0.x
- ${{ if eq(parameters.DoEsrp, 'true') }}:
- task: UseDotNet@2
displayName: Setup .NET 6.0 (For ESRP Task)
Expand Down Expand Up @@ -83,7 +83,7 @@ stages:
InputType: 'Basic'
Function: 'analyze'
TargetPattern: guardianGlob
AnalyzeTargetGlob: 'MSStore.API\bin\$(dotnet_configuration)\net7.0\MSStore.API.dll'
AnalyzeTargetGlob: 'MSStore.API\bin\$(dotnet_configuration)\net8.0\MSStore.API.dll'
AnalyzeVerbose: true
toolVersion: 'Latest'
- task: PoliCheck@2
Expand Down Expand Up @@ -120,19 +120,19 @@ stages:
${{ dotnet_config }}_windows_${{ platform }}:
os: windows-latest
dotnet_runtime: win
dotnet_framework: net7.0-windows10.0.17763.0
dotnet_framework: net8.0-windows10.0.17763.0
dotnet_arch: ${{ platform }}
dotnet_configuration: ${{ dotnet_config }}
${{ dotnet_config }}_linux_${{ platform }}:
os: ubuntu-latest
dotnet_runtime: linux
dotnet_framework: net7.0
dotnet_framework: net8.0
dotnet_arch: ${{ platform }}
dotnet_configuration: ${{ dotnet_config }}
${{ dotnet_config }}_macos_${{ platform }}:
os: macos-latest
dotnet_runtime: osx.12
dotnet_framework: net7.0
dotnet_framework: net8.0
dotnet_arch: ${{ platform }}
dotnet_configuration: ${{ dotnet_config }}
pool:
Expand All @@ -146,7 +146,7 @@ stages:
- task: UseDotNet@2
displayName: Setup .NET 7
inputs:
version: 7.0.x
version: 8.0.x
- ${{ if eq(parameters.DoEsrp, 'true') }}:
- task: UseDotNet@2
displayName: Setup .NET 6.0 (For ESRP Task)
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/templates/after-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ steps:
InputType: 'Basic'
Function: 'analyze'
TargetPattern: guardianGlob
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\${{ parameters.dotnet_configuration }}\net7.0\MSStore.API.dll'
AnalyzeTargetGlob: '$(System.DefaultWorkingDirectory)\MSStore.API\bin\${{ parameters.dotnet_configuration }}\net8.0\MSStore.API.dll'
AnalyzeVerbose: true
toolVersion: 'Latest'
- task: PoliCheck@2
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/templates/build-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ steps:
condition: startsWith(variables.AgentOS, 'Linux')
inputs:
ConnectedServiceName: 'MSStoreCLI - ESRP Code Signing'
FolderPath: '$(System.DefaultWorkingDirectory)/MSStore.API/bin/${{ parameters.dotnet_configuration }}/net7.0'
FolderPath: '$(System.DefaultWorkingDirectory)/MSStore.API/bin/${{ parameters.dotnet_configuration }}/net8.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 @@ -50,7 +50,7 @@ steps:
displayName: 'Copy Artifacts - NuGet DLLs'
condition: startsWith(variables.AgentOS, 'Linux')
inputs:
contents: '$(System.DefaultWorkingDirectory)/MSStore.API/bin/${{ parameters.dotnet_configuration }}/net7.0/*'
contents: '$(System.DefaultWorkingDirectory)/MSStore.API/bin/${{ parameters.dotnet_configuration }}/net8.0/*'
flattenFolders: true
targetFolder: '$(Build.ArtifactStagingDirectory)/NuGetDLLs'
- task: PublishPipelineArtifact@1
Expand Down
8 changes: 4 additions & 4 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>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- TODO: Fully enable docs -->
<NoWarn>$(NoWarn);CS1591</NoWarn>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand All @@ -20,9 +20,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.56.0" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.56.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.57.0" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.57.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
</ItemGroup>

</Project>
6 changes: 0 additions & 6 deletions MSStore.API/MSStoreException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System;
using System.Runtime.Serialization;

namespace MSStore.API
{
Expand All @@ -21,10 +20,5 @@ public MSStoreException(string? message, Exception? innerException)
: base(message, innerException)
{
}

protected MSStoreException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
17 changes: 9 additions & 8 deletions MSStore.API/Packaged/StorePackagedAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -18,14 +19,14 @@ namespace MSStore.API.Packaged
public class StorePackagedAPI : IStorePackagedAPI, IDisposable
{
private static readonly string DevCenterVersion = "1.0";
private static readonly string DevCenterApplicationsTemplate = "/v{0}/my/applications?skip={1}&top={2}";
private static readonly string DevCenterApplicationTemplate = "/v{0}/my/applications/{1}";
private static readonly string DevCenterGetSubmissionTemplate = "/v{0}/my/applications/{1}/submissions/{2}";
private static readonly string DevCenterPutSubmissionTemplate = "/v{0}/my/applications/{1}/submissions/{2}";
private static readonly string DevCenterCreateSubmissionTemplate = "/v{0}/my/applications/{1}/submissions?isMinimalResponse=true";
private static readonly string DevCenterDeleteSubmissionTemplate = "/v{0}/my/applications/{1}/submissions/{2}";
private static readonly string DevCenterCommitSubmissionTemplate = "/v{0}/my/applications/{1}/submissions/{2}/Commit";
private static readonly string DevCenterSubmissionStatusTemplate = "/v{0}/my/applications/{1}/submissions/{2}/status";
private static readonly CompositeFormat DevCenterApplicationsTemplate = CompositeFormat.Parse("/v{0}/my/applications?skip={1}&top={2}");
private static readonly CompositeFormat DevCenterApplicationTemplate = CompositeFormat.Parse("/v{0}/my/applications/{1}");
private static readonly CompositeFormat DevCenterGetSubmissionTemplate = CompositeFormat.Parse("/v{0}/my/applications/{1}/submissions/{2}");
private static readonly CompositeFormat DevCenterPutSubmissionTemplate = CompositeFormat.Parse("/v{0}/my/applications/{1}/submissions/{2}");
private static readonly CompositeFormat DevCenterCreateSubmissionTemplate = CompositeFormat.Parse("/v{0}/my/applications/{1}/submissions?isMinimalResponse=true");
private static readonly CompositeFormat DevCenterDeleteSubmissionTemplate = CompositeFormat.Parse("/v{0}/my/applications/{1}/submissions/{2}");
private static readonly CompositeFormat DevCenterCommitSubmissionTemplate = CompositeFormat.Parse("/v{0}/my/applications/{1}/submissions/{2}/Commit");
private static readonly CompositeFormat DevCenterSubmissionStatusTemplate = CompositeFormat.Parse("/v{0}/my/applications/{1}/submissions/{2}/status");

private SubmissionClient? _devCenterClient;

Expand Down
17 changes: 9 additions & 8 deletions MSStore.API/StoreAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -19,17 +20,17 @@ namespace MSStore.API
public class StoreAPI : IStoreAPI, IDisposable
{
private static readonly string Version = "1";
private static readonly string PackagesUrlTemplate = "/submission/v{0}/product/{1}/packages";
private static readonly CompositeFormat PackagesUrlTemplate = CompositeFormat.Parse("/submission/v{0}/product/{1}/packages");
/* private static readonly string PackageByIdUrlTemplate = "/submission/v{0}/product/{1}/packages/{2}"; */
private static readonly string PackagesCommitUrlTemplate = "/submission/v{0}/product/{1}/packages/commit";
private static readonly string AppMetadataUrlTemplate = "/submission/v{0}/product/{1}/metadata";
private static readonly string AppModuleFetchMetadataUrlTemplate = "/submission/v{0}/product/{1}/metadata/{2}?languages={3}";
private static readonly string ListingAssetsUrlTemplate = "/submission/v{0}/product/{1}/listings/assets?languages={2}";
private static readonly CompositeFormat PackagesCommitUrlTemplate = CompositeFormat.Parse("/submission/v{0}/product/{1}/packages/commit");
private static readonly CompositeFormat AppMetadataUrlTemplate = CompositeFormat.Parse("/submission/v{0}/product/{1}/metadata");
private static readonly CompositeFormat AppModuleFetchMetadataUrlTemplate = CompositeFormat.Parse("/submission/v{0}/product/{1}/metadata/{2}?languages={3}");
private static readonly CompositeFormat ListingAssetsUrlTemplate = CompositeFormat.Parse("/submission/v{0}/product/{1}/listings/assets?languages={2}");
/* private static readonly string ListingAssetsCreateUrlTemplate = "/submission/v{0}/product/{1}/listings/assets/create";
private static readonly string ListingAssetsCommitUrlTemplate = "/submission/v{0}/product/{1}/listings/assets/commit"; */
private static readonly string ProductDraftStatusPollingUrlTemplate = "/submission/v{0}/product/{1}/status";
private static readonly string CreateSubmissionUrlTemplate = "/submission/v{0}/product/{1}/submit";
private static readonly string SubmissionStatusPollingUrlTemplate = "/submission/v{0}/product/{1}/submission/{2}/status";
private static readonly CompositeFormat ProductDraftStatusPollingUrlTemplate = CompositeFormat.Parse("/submission/v{0}/product/{1}/status");
private static readonly CompositeFormat CreateSubmissionUrlTemplate = CompositeFormat.Parse("/submission/v{0}/product/{1}/submit");
private static readonly CompositeFormat SubmissionStatusPollingUrlTemplate = CompositeFormat.Parse("/submission/v{0}/product/{1}/submission/{2}/status");

private SubmissionClient? _client;

Expand Down
5 changes: 2 additions & 3 deletions MSStore.API/SubmissionClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
Expand Down Expand Up @@ -66,7 +65,7 @@ public SubmissionClient(AuthenticationResult accessToken, string serviceUrl, Htt
}

this.accessToken = accessToken;
if(httpClient != null)
if (httpClient != null)
{
this.httpClient = httpClient;
httpClientIsInternal = false;
Expand Down Expand Up @@ -237,7 +236,7 @@ public async Task<T> InvokeAsync<T>(
{
var errors = (List<ResponseError>?)errorsProp.GetValue(resource);
var isSuccess = (bool?)isSuccessProp.GetValue(resource);
if (errors?.Any() == true
if (errors?.Count > 0
&& isSuccess == false)
{
if (resource is T t)
Expand Down
2 changes: 1 addition & 1 deletion MSStore.CLI.UnitTests/GraphClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace MSStore.CLI.UnitTests
public class GraphClientTests
{
private Mock<ITokenManager> mockTokenManager = null!;
private IGraphClient _graphClient = null!;
private GraphClient _graphClient = null!;
private Mock<HttpMessageHandler> _httpMessageHandler = null!;

[TestInitialize]
Expand Down
10 changes: 5 additions & 5 deletions MSStore.CLI.UnitTests/MSStore.CLI.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">net7.0;net7.0-windows10.0.17763.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('windows'))">net7.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">net8.0;net8.0-windows10.0.17763.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('windows'))">net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
Expand All @@ -22,10 +22,10 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Compile Remove="CredentialManagerWindowsTests.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-windows10.0.17763.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows10.0.17763.0'">
<Compile Remove="CredentialManagerUnixTests.cs" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions MSStore.CLI.UnitTests/PackageCommandUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public async Task PackageCommandForMauiAppsShouldCallMSBuildIfWindows()
ExternalCommandExecutor
.Setup(x => x.RunAsync(
It.Is<string>(s => s == "dotnet"),
It.Is<string>(s => s.Contains("publish -f net7.0-windows10.0.19041.0 -r win10-x64 --self-contained /p:Configuration=Release")),
It.Is<string>(s => s.Contains("publish -f net8.0-windows10.0.19041.0 -r win10-x64 --self-contained /p:Configuration=Release")),
It.Is<string>(s => s == dirInfo.FullName),
It.IsAny<CancellationToken>()))
.ReturnsAsync(new Services.ExternalCommandExecutionResult
Expand Down Expand Up @@ -305,7 +305,7 @@ public async Task PackageCommandForMauiAppsShouldCallMSBuildWithOutputParameterI
ExternalCommandExecutor
.Setup(x => x.RunAsync(
It.Is<string>(s => s == "dotnet"),
It.Is<string>(s => s.Contains("publish -f net7.0-windows10.0.19041.0 -r win10-x64 --self-contained /p:Configuration=Release")
It.Is<string>(s => s.Contains("publish -f net8.0-windows10.0.19041.0 -r win10-x64 --self-contained /p:Configuration=Release")
&& s.Contains($"AppxPackageDir={customPath}\\;")
&& s.EndsWith($"AppxPackageTestDir={customPath}\\MauiProject_1.0.0.0_X64_Test\\")),
It.Is<string>(s => s == dirInfo.FullName),
Expand Down
4 changes: 2 additions & 2 deletions MSStore.CLI.UnitTests/ProjectConfiguratorFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ProjectConfiguratorFactoryTests : BaseCommandLineTest
public async Task ProjectConfiguratorFactoryFindsURLProperly(string pathOrUrl, Type expectedProjectConfiguratorType, params string[] testDataProjectSubPath)
{
string? path = null;
if (testDataProjectSubPath != null && testDataProjectSubPath.Any())
if (testDataProjectSubPath != null && testDataProjectSubPath.Length != 0)
{
path = CopyFilesRecursively(Path.Combine(testDataProjectSubPath));

Expand All @@ -40,7 +40,7 @@ await RunTestAsync(async (context) =>
var host = context.GetHost();
var projectConfiguratorFactory = host.Services.GetService<IProjectConfiguratorFactory>()!;

if (testDataProjectSubPath != null && testDataProjectSubPath.Any() && path != null)
if (testDataProjectSubPath != null && testDataProjectSubPath.Length != 0 && path != null)
{
SetupBasedOnTestDataProjectSubPath(new DirectoryInfo(path), testDataProjectSubPath);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<ApplicationIdGuid>00000000-0000-0000-0000-000000000000</ApplicationIdGuid>
<ApplicationTitle>AppTitle</ApplicationTitle>
<UseMaui>true</UseMaui>
Expand Down
3 changes: 1 addition & 2 deletions MSStore.CLI/Commands/Apps/ListCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -55,7 +54,7 @@ await AnsiConsole.Status().StartAsync("Retrieving Managed Applications", async c

ctx.SuccessStatus("[bold green]Retrieved Managed Applications[/]");

if (appList?.Any() == true)
if (appList?.Count > 0)
{
var table = new Table();
table.AddColumns(string.Empty, "ProductId", "Display Name", "PackageId");
Expand Down
2 changes: 1 addition & 1 deletion MSStore.CLI/Commands/InitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public async Task<int> InvokeAsync(InvocationContext context)
return null;
}

if (appList.Any() != true)
if (appList.Count == 0)
{
AnsiConsole.WriteLine("Your account has no registered apps yet.");
AnsiConsole.MarkupLine("[b]Let's create one![/]");
Expand Down
Loading

0 comments on commit 0d63e72

Please sign in to comment.