From 2e0fc8eb1f87fb7e597b062f0affb079def0a87a Mon Sep 17 00:00:00 2001 From: delubear Date: Wed, 25 Jan 2023 20:03:03 -0600 Subject: [PATCH 1/4] updated to .net7 --- .github/workflows/dotnet-core.yml | 4 ++-- .github/workflows/pr.yml | 2 +- GlucoseTray/GlucoseTray.csproj | 20 ++++++++++---------- GlucoseTray/appsettings.json | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 99b5b74..ac20c43 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.x + dotnet-version: 7.x - name: Install dependencies run: dotnet restore - name: Build @@ -38,7 +38,7 @@ jobs: #artifact: # An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs) #artifacts: './GlucoseTray/bin/Release/net5.0-windows/win-x64/publish/' - artifacts: './GlucoseTray/bin/Release/net6.0-windows/win-x64/publish/GlucoseTray.exe' + artifacts: './GlucoseTray/bin/Release/net7.0-windows/win-x64/publish/GlucoseTray.exe' # The content type of the artifact. Defaults to raw #artifactContentType: # optional, default is # An optional body for the release. diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 86a397f..eb18322 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.x + dotnet-version: 7.x - name: Install dependencies run: dotnet restore - name: Build diff --git a/GlucoseTray/GlucoseTray.csproj b/GlucoseTray/GlucoseTray.csproj index 9fbd962..4493ca3 100644 --- a/GlucoseTray/GlucoseTray.csproj +++ b/GlucoseTray/GlucoseTray.csproj @@ -2,7 +2,7 @@ WinExe - net6.0-windows + net7.0-windows GlucoseTray true @@ -31,16 +31,16 @@ - - - - - - - + + + + + + + - - + + diff --git a/GlucoseTray/appsettings.json b/GlucoseTray/appsettings.json index 957a54e..fba159b 100644 --- a/GlucoseTray/appsettings.json +++ b/GlucoseTray/appsettings.json @@ -1,5 +1,5 @@ { "appsettings": { - "Version": "13.3.0" + "Version": "14.0.0" } } \ No newline at end of file From dde4828de1cb8f2e6f2210af1c020b967d5e3454 Mon Sep 17 00:00:00 2001 From: delubear Date: Wed, 25 Jan 2023 20:09:44 -0600 Subject: [PATCH 2/4] Stopped using obsolete cryptography method as recommended by VS. --- GlucoseTray/Services/StringEncryptionService.cs | 6 +++--- GlucoseTray/appsettings.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GlucoseTray/Services/StringEncryptionService.cs b/GlucoseTray/Services/StringEncryptionService.cs index cb774f5..fcc8d70 100644 --- a/GlucoseTray/Services/StringEncryptionService.cs +++ b/GlucoseTray/Services/StringEncryptionService.cs @@ -23,7 +23,7 @@ public static string EncryptString(string plainText, string passPhrase) byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText); var password = new PasswordDeriveBytes(passPhrase, null); byte[] keyBytes = password.GetBytes(keysize / 8); - var symmetricKey = Aes.Create("AesManaged"); + var symmetricKey = Aes.Create(); symmetricKey.Mode = CipherMode.CBC; ICryptoTransform encryptor = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes); var memoryStream = new MemoryStream(); @@ -42,7 +42,7 @@ public static string DecryptString(string cipherText, string passPhrase) byte[] cipherTextBytes = Convert.FromBase64String(cipherText); var password = new PasswordDeriveBytes(passPhrase, null); byte[] keyBytes = password.GetBytes(keysize / 8); - var symmetricKey = Aes.Create("AesManaged"); + var symmetricKey = Aes.Create(); symmetricKey.Mode = CipherMode.CBC; ICryptoTransform decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes); var memoryStream = new MemoryStream(cipherTextBytes); @@ -57,7 +57,7 @@ public static string DecryptString(string cipherText, string passPhrase) byte[] tempBytes = new byte[cipherTextBytes.Length]; do { - int bytesRead = cryptoStream.Read(tempBytes, 0, tempBytes.Length); + int bytesRead = cryptoStream.Read(tempBytes, 0, tempBytes.Length); if (bytesRead == 0) break; diff --git a/GlucoseTray/appsettings.json b/GlucoseTray/appsettings.json index f668814..d8d0f3a 100644 --- a/GlucoseTray/appsettings.json +++ b/GlucoseTray/appsettings.json @@ -1,6 +1,6 @@ { "appsettings": { - "Version": "14.0.0", + "Version": "14.0.1", "Url": "https://github.com/Delubear/GlucoseTray" } } \ No newline at end of file From be71c980cfd4571b9508f92dc1718e1d7b71e58c Mon Sep 17 00:00:00 2001 From: delubear Date: Wed, 25 Jan 2023 20:12:02 -0600 Subject: [PATCH 3/4] Fixed some missed net6 references --- .../PublishProfiles/PublishToSingleSelfContainedExe.pubxml | 4 ++-- GlucoseTray/appsettings.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GlucoseTray/Properties/PublishProfiles/PublishToSingleSelfContainedExe.pubxml b/GlucoseTray/Properties/PublishProfiles/PublishToSingleSelfContainedExe.pubxml index b547112..a5ff1d8 100644 --- a/GlucoseTray/Properties/PublishProfiles/PublishToSingleSelfContainedExe.pubxml +++ b/GlucoseTray/Properties/PublishProfiles/PublishToSingleSelfContainedExe.pubxml @@ -7,8 +7,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem Release Any CPU - net6.0-windows - bin\Release\net6.0-windows\win-x64\publish\ + net7.0-windows + bin\Release\net7.0-windows\win-x64\publish\ win-x64 true True diff --git a/GlucoseTray/appsettings.json b/GlucoseTray/appsettings.json index d8d0f3a..2cd7e84 100644 --- a/GlucoseTray/appsettings.json +++ b/GlucoseTray/appsettings.json @@ -1,6 +1,6 @@ { "appsettings": { - "Version": "14.0.1", + "Version": "14.0.2", "Url": "https://github.com/Delubear/GlucoseTray" } } \ No newline at end of file From b36c140bc8b57ca882c5133fbdd91ac670ffeff3 Mon Sep 17 00:00:00 2001 From: delubear Date: Sat, 28 Jan 2023 16:17:47 -0600 Subject: [PATCH 4/4] Fix for .net7 WPF bug related to Single File and Ready to Run publishes. --- GlucoseTray/GlucoseTray.csproj | 9 +-------- GlucoseTray/Program.cs | 2 +- .../PublishToSingleSelfContainedExe.pubxml | 7 ++++--- GlucoseTray/appsettings.json | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/GlucoseTray/GlucoseTray.csproj b/GlucoseTray/GlucoseTray.csproj index 3d427f3..7d39a65 100644 --- a/GlucoseTray/GlucoseTray.csproj +++ b/GlucoseTray/GlucoseTray.csproj @@ -4,7 +4,7 @@ WinExe net7.0-windows GlucoseTray - true + false true win-x64 @@ -37,11 +37,4 @@ - - - - - - - diff --git a/GlucoseTray/Program.cs b/GlucoseTray/Program.cs index cf6e14a..48285c8 100644 --- a/GlucoseTray/Program.cs +++ b/GlucoseTray/Program.cs @@ -76,6 +76,6 @@ private static bool LoadApplicationSettings() return true; } - private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e) => MessageBox.Show(JsonSerializer.Serialize(e), "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e) => MessageBox.Show(e?.Exception?.Message + " --- " + e?.Exception?.InnerException?.Message, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } \ No newline at end of file diff --git a/GlucoseTray/Properties/PublishProfiles/PublishToSingleSelfContainedExe.pubxml b/GlucoseTray/Properties/PublishProfiles/PublishToSingleSelfContainedExe.pubxml index a5ff1d8..5b6deae 100644 --- a/GlucoseTray/Properties/PublishProfiles/PublishToSingleSelfContainedExe.pubxml +++ b/GlucoseTray/Properties/PublishProfiles/PublishToSingleSelfContainedExe.pubxml @@ -6,13 +6,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem Release - Any CPU + AnyCPU net7.0-windows bin\Release\net7.0-windows\win-x64\publish\ win-x64 true - True - True + true + false true + true \ No newline at end of file diff --git a/GlucoseTray/appsettings.json b/GlucoseTray/appsettings.json index 2cd7e84..f5c842e 100644 --- a/GlucoseTray/appsettings.json +++ b/GlucoseTray/appsettings.json @@ -1,6 +1,6 @@ { "appsettings": { - "Version": "14.0.2", + "Version": "14.0.3", "Url": "https://github.com/Delubear/GlucoseTray" } } \ No newline at end of file