From 4f6e9dbd69d5b8cbcbbc5fbe1b9b42b2c7d49bab Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Thu, 29 Sep 2022 01:28:34 -0700 Subject: [PATCH 01/11] Attempt using net6 with latest MSAL --- src/AzureAuth.Test/AzureAuth.Test.csproj | 4 ++-- src/AzureAuth/AzureAuth.csproj | 3 +-- src/MSALWrapper/MSALWrapper.csproj | 23 +++++++++++++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/AzureAuth.Test/AzureAuth.Test.csproj b/src/AzureAuth.Test/AzureAuth.Test.csproj index 1d92a7b9..2ba50a26 100644 --- a/src/AzureAuth.Test/AzureAuth.Test.csproj +++ b/src/AzureAuth.Test/AzureAuth.Test.csproj @@ -1,8 +1,8 @@  - net5.0-windows10.0.17763.0 - 7 + net6.0-windows + PlatformWindows diff --git a/src/AzureAuth/AzureAuth.csproj b/src/AzureAuth/AzureAuth.csproj index e5b0cda1..4dc55be5 100644 --- a/src/AzureAuth/AzureAuth.csproj +++ b/src/AzureAuth/AzureAuth.csproj @@ -1,8 +1,7 @@  - net5.0-windows10.0.17763.0 - 7 + net6.0-windows PlatformWindows diff --git a/src/MSALWrapper/MSALWrapper.csproj b/src/MSALWrapper/MSALWrapper.csproj index 240b77df..8484bb4d 100644 --- a/src/MSALWrapper/MSALWrapper.csproj +++ b/src/MSALWrapper/MSALWrapper.csproj @@ -21,7 +21,7 @@ True True - + PlatformWindows @@ -38,13 +38,24 @@ - - - + + + + + + + - - + + + + 4.47.1 + + + + $(PkgPMicrosoft_Identity_Client)\lib\net5.0-windows10.0.17763\Microsoft.Identity.Client.dll + From 0d93c40f732dcd6ac7e35d884e94b4be04cf886b Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Thu, 29 Sep 2022 11:50:21 -0700 Subject: [PATCH 02/11] Use target version net6.0-windows10.0.19041.0 --- src/AzureAuth.Test/AzureAuth.Test.csproj | 2 +- src/AzureAuth/AzureAuth.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AzureAuth.Test/AzureAuth.Test.csproj b/src/AzureAuth.Test/AzureAuth.Test.csproj index 2ba50a26..e60fedb4 100644 --- a/src/AzureAuth.Test/AzureAuth.Test.csproj +++ b/src/AzureAuth.Test/AzureAuth.Test.csproj @@ -1,7 +1,7 @@  - net6.0-windows + net6.0-windows10.0.19041.0 PlatformWindows diff --git a/src/AzureAuth/AzureAuth.csproj b/src/AzureAuth/AzureAuth.csproj index 4dc55be5..ded02340 100644 --- a/src/AzureAuth/AzureAuth.csproj +++ b/src/AzureAuth/AzureAuth.csproj @@ -1,7 +1,7 @@  - net6.0-windows + net6.0-windows10.0.19041.0 PlatformWindows From ec7b4480cb6aa12e2d836f98e8882a0a367659a3 Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Thu, 29 Sep 2022 11:51:33 -0700 Subject: [PATCH 03/11] Remove net5 installation from CI pipelines --- .github/workflows/dotnet-test.yml | 14 ++------------ .github/workflows/release.yml | 9 +-------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 476cbe55..39ace7f7 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -17,16 +17,6 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Setup .NET 5 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.x - source-url: https://office.pkgs.visualstudio.com/DefaultCollection/_packaging/Office/nuget/v3/index.json - env: - NUGET_AUTH_TOKEN: ${{ secrets.ADO_TOKEN }} - - name: Setup .NET 6 uses: actions/setup-dotnet@v1 with: @@ -37,9 +27,9 @@ jobs: - name: Restore dependencies run: dotnet restore - + - name: Build run: dotnet build --no-restore - + - name: Test run: dotnet test --no-build --verbosity normal diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index adb8244b..b5e51620 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,13 +47,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Setup .NET 5 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.x - source-url: https://office.pkgs.visualstudio.com/DefaultCollection/_packaging/Office/nuget/v3/index.json - env: - NUGET_AUTH_TOKEN: ${{ secrets.ADO_TOKEN }} - name: Setup .NET 6 uses: actions/setup-dotnet@v1 with: @@ -175,7 +168,7 @@ jobs: with: name: azureauth-${{ github.event.inputs.version }}-osx-arm64.tar.gz path: azureauth-${{ github.event.inputs.version }}-osx-arm64.tar.gz - + release: runs-on: ubuntu-latest needs: [package] From 934b858845c79d68a1eda65b91b253495de5971e Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Thu, 29 Sep 2022 23:50:19 -0700 Subject: [PATCH 04/11] Add link to Github issue on net6 target --- src/MSALWrapper/MSALWrapper.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MSALWrapper/MSALWrapper.csproj b/src/MSALWrapper/MSALWrapper.csproj index 8484bb4d..aa648d27 100644 --- a/src/MSALWrapper/MSALWrapper.csproj +++ b/src/MSALWrapper/MSALWrapper.csproj @@ -48,7 +48,8 @@ - + + 4.47.1 From 27b2035535b0aca9d1d9150700e6cb1db7b4e012 Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Fri, 30 Sep 2022 11:37:30 -0700 Subject: [PATCH 05/11] Enable COM features and remove extra assembly includes --- src/AzureAuth/AzureAuth.csproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/AzureAuth/AzureAuth.csproj b/src/AzureAuth/AzureAuth.csproj index ded02340..35b0cbcb 100644 --- a/src/AzureAuth/AzureAuth.csproj +++ b/src/AzureAuth/AzureAuth.csproj @@ -3,6 +3,7 @@ net6.0-windows10.0.19041.0 PlatformWindows + true @@ -13,6 +14,7 @@ net6.0 + true true @@ -53,4 +55,10 @@ + + + + + + \ No newline at end of file From 6deea8bad743c01edfdf56e8b97cd9c904d93fec Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Fri, 30 Sep 2022 11:57:50 -0700 Subject: [PATCH 06/11] Include local publish script for win in bin\ --- bin/publish-win.cmd | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 bin/publish-win.cmd diff --git a/bin/publish-win.cmd b/bin/publish-win.cmd new file mode 100644 index 00000000..24418605 --- /dev/null +++ b/bin/publish-win.cmd @@ -0,0 +1,4 @@ +@ECHO OFF + +rmdir /S /Q %~dp0\dist +dotnet publish %~dp0\..\src\AzureAuth\AzureAuth.csproj --self-contained true -r win10-x64 -c release -o %~dp0\..\dist %* \ No newline at end of file From 290a473446a59a7206bdafa7eee76c461c57f066 Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Fri, 30 Sep 2022 12:47:51 -0700 Subject: [PATCH 07/11] Add mac local publish script --- bin/mac_publish.sh | 42 ++++++++++++++++++++++++ bin/{publish-win.cmd => win_publish.cmd} | 0 2 files changed, 42 insertions(+) create mode 100755 bin/mac_publish.sh rename bin/{publish-win.cmd => win_publish.cmd} (100%) diff --git a/bin/mac_publish.sh b/bin/mac_publish.sh new file mode 100755 index 00000000..6f56fb8a --- /dev/null +++ b/bin/mac_publish.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +# Fail on any failed commands +set -e + +GIT_DIR="$(git rev-parse --show-toplevel)" +DIST="$GIT_DIR/dist" + +# Clean Up existing dist. +rm -rf "$DIST" + +# This block stolen from our src/install.sh +#------------------------------------------ +os_info="$(uname -a)" +os_name="$(echo $os_info | cut -d ' ' -f1)" +case "${os_name}" in + Darwin) + name="${name}-osx" + arch="$(echo $os_info | rev | cut -d ' ' -f1 | rev)" + + case "${arch}" in + arm64) + runtime="osx-arm64" + ;; + x86_64) + runtime="osx-x64" + ;; + *) + error "Unsupported architecture '${arch}'" + exit 1 + ;; + esac + ;; + *) + error "Unsupported OS '${os_name}'" + exit 1 + ;; +esac +#------------------------------------------ + +# Publish +dotnet publish "$GIT_DIR/src/AzureAuth/AzureAuth.csproj" --self-contained true -r "$runtime" -c release -o $DIST $* \ No newline at end of file diff --git a/bin/publish-win.cmd b/bin/win_publish.cmd similarity index 100% rename from bin/publish-win.cmd rename to bin/win_publish.cmd From 3814e971c1cc28b57a791e43f5a8e443150fe0fc Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Fri, 21 Oct 2022 12:06:23 -0700 Subject: [PATCH 08/11] Revert upgrade to MSAL version --- src/MSALWrapper/AuthFlow/Broker.cs | 4 ++-- src/MSALWrapper/MSALWrapper.csproj | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/MSALWrapper/AuthFlow/Broker.cs b/src/MSALWrapper/AuthFlow/Broker.cs index 7fdf09d6..6f33ed08 100644 --- a/src/MSALWrapper/AuthFlow/Broker.cs +++ b/src/MSALWrapper/AuthFlow/Broker.cs @@ -86,8 +86,8 @@ private enum GetAncestorFlags public async Task GetTokenAsync() { IAccount account = await this.pcaWrapper.TryToGetCachedAccountAsync(this.preferredDomain) - ?? Identity.Client.PublicClientApplication.OperatingSystemAccount; - this.logger.LogDebug($"Using cached account '{account.Username}'"); + ?? PublicClientApplication.OperatingSystemAccount; + this.logger.LogDebug($"Using cached account '{account?.Username}'"); try { diff --git a/src/MSALWrapper/MSALWrapper.csproj b/src/MSALWrapper/MSALWrapper.csproj index aa648d27..9fa3b560 100644 --- a/src/MSALWrapper/MSALWrapper.csproj +++ b/src/MSALWrapper/MSALWrapper.csproj @@ -31,31 +31,31 @@ - all - runtime; build; native; contentfiles; analyzers; buildtransitive + all + runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - + + - 4.47.1 + 4.43.1 - $(PkgPMicrosoft_Identity_Client)\lib\net5.0-windows10.0.17763\Microsoft.Identity.Client.dll + $(PkgPMicrosoft_Identity_Client)\lib\net5.0-windows10.0.17763\Microsoft.Identity.Client.dll From 5fb1bf2e9a98dabdd732f612d851db2a1739e8e8 Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Fri, 21 Oct 2022 12:08:42 -0700 Subject: [PATCH 09/11] Add blank line at the end of publish scripts --- bin/mac_publish.sh | 2 +- bin/win_publish.cmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mac_publish.sh b/bin/mac_publish.sh index 6f56fb8a..615c5af5 100755 --- a/bin/mac_publish.sh +++ b/bin/mac_publish.sh @@ -39,4 +39,4 @@ esac #------------------------------------------ # Publish -dotnet publish "$GIT_DIR/src/AzureAuth/AzureAuth.csproj" --self-contained true -r "$runtime" -c release -o $DIST $* \ No newline at end of file +dotnet publish "$GIT_DIR/src/AzureAuth/AzureAuth.csproj" --self-contained true -r "$runtime" -c release -o $DIST $* diff --git a/bin/win_publish.cmd b/bin/win_publish.cmd index 24418605..2d7f36b6 100644 --- a/bin/win_publish.cmd +++ b/bin/win_publish.cmd @@ -1,4 +1,4 @@ @ECHO OFF rmdir /S /Q %~dp0\dist -dotnet publish %~dp0\..\src\AzureAuth\AzureAuth.csproj --self-contained true -r win10-x64 -c release -o %~dp0\..\dist %* \ No newline at end of file +dotnet publish %~dp0\..\src\AzureAuth\AzureAuth.csproj --self-contained true -r win10-x64 -c release -o %~dp0\..\dist %* From 1ea5c12d8f43f2db574d53dade42119ec09b4cee Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Fri, 21 Oct 2022 13:12:31 -0700 Subject: [PATCH 10/11] Update changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2fcfd37..3fa6b9b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# Unreleased + +### Changed +- Upgrade the Windows build to use net6 now that net5 has reached end of life. + ## [0.5.4] - 2022-09-29 ### Fixed - Enable IWA authmode when interactive authentication is disabled. @@ -15,7 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.5.2] - 2022-09-28 ### Fixed - Option `--resource` is not needed if option `--scope` is provided. -- Refactoring IWA AuthFlow to call GetTokenIWA when we have a MsalUiRequiredException +- Refactoring IWA AuthFlow to call GetTokenIWA when we have a MsalUiRequiredException ## [0.5.1] - 2022-09-08 ### Fixed From 3bf437c675c642ece4fb18e40d86fba017f51e91 Mon Sep 17 00:00:00 2001 From: Kyle Rader Date: Fri, 21 Oct 2022 15:12:54 -0700 Subject: [PATCH 11/11] Remove NET472 compilation condition --- src/MSALWrapper/AuthFlow/Broker.cs | 3 --- src/MSALWrapper/AuthFlow/DeviceCode.cs | 3 --- src/MSALWrapper/AuthFlow/Web.cs | 3 --- 3 files changed, 9 deletions(-) diff --git a/src/MSALWrapper/AuthFlow/Broker.cs b/src/MSALWrapper/AuthFlow/Broker.cs index 6f33ed08..c06b7c4d 100644 --- a/src/MSALWrapper/AuthFlow/Broker.cs +++ b/src/MSALWrapper/AuthFlow/Broker.cs @@ -3,9 +3,6 @@ namespace Microsoft.Authentication.MSALWrapper.AuthFlow { -#if NET472 - using Microsoft.Identity.Client.Desktop; -#endif using System; using System.Collections.Generic; using System.Runtime.InteropServices; diff --git a/src/MSALWrapper/AuthFlow/DeviceCode.cs b/src/MSALWrapper/AuthFlow/DeviceCode.cs index 58b184ae..243cc5f2 100644 --- a/src/MSALWrapper/AuthFlow/DeviceCode.cs +++ b/src/MSALWrapper/AuthFlow/DeviceCode.cs @@ -3,9 +3,6 @@ namespace Microsoft.Authentication.MSALWrapper.AuthFlow { -#if NET472 - using Microsoft.Identity.Client.Desktop; -#endif using System; using System.Collections.Generic; using System.Net.Http; diff --git a/src/MSALWrapper/AuthFlow/Web.cs b/src/MSALWrapper/AuthFlow/Web.cs index f9f321f4..c50c7e09 100644 --- a/src/MSALWrapper/AuthFlow/Web.cs +++ b/src/MSALWrapper/AuthFlow/Web.cs @@ -3,9 +3,6 @@ namespace Microsoft.Authentication.MSALWrapper.AuthFlow { -#if NET472 - using Microsoft.Identity.Client.Desktop; -#endif using System; using System.Collections.Generic; using System.Net.Http;