From 8eaa72a02ed50c35362ed70994bf9408c34e1b57 Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Wed, 17 Nov 2021 11:53:24 -0500 Subject: [PATCH 1/4] Added conditional PlatformToolset for VS 2022. --- src/AppInstallerCLICore/AppInstallerCLICore.vcxproj | 1 + src/AppInstallerCLITests/AppInstallerCLITests.vcxproj | 1 + src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj | 1 + .../AppInstallerRepositoryCore.vcxproj | 1 + .../AppInstallerTestExeInstaller.vcxproj | 1 + .../Microsoft.Management.Deployment.Client.vcxproj | 1 + .../Microsoft.Management.Deployment.Server.Test.vcxproj | 1 + .../Microsoft.Management.Deployment.vcxproj | 1 + src/WinGetServer/WinGetServer.vcxproj | 1 + src/WinGetUtil/WinGetUtil.vcxproj | 1 + src/YamlCppLib/YamlCppLib.vcxproj | 1 + .../AppInstallerCaller/AppInstallerCaller.vcxproj | 1 + 12 files changed, 12 insertions(+) diff --git a/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj b/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj index bdde3e2b53..50b644faca 100644 --- a/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj +++ b/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj @@ -54,6 +54,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj index c4ff30b834..987f5f01cc 100644 --- a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj +++ b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj @@ -38,6 +38,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj b/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj index 146ae53d3a..8b4e91634b 100644 --- a/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj +++ b/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj @@ -58,6 +58,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj b/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj index ea61b97a93..a804eef011 100644 --- a/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj +++ b/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj @@ -54,6 +54,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.vcxproj b/src/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.vcxproj index 3c0f51c366..3b062acd69 100644 --- a/src/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.vcxproj +++ b/src/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.vcxproj @@ -50,6 +50,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/Microsoft.Management.Deployment.Client/Microsoft.Management.Deployment.Client.vcxproj b/src/Microsoft.Management.Deployment.Client/Microsoft.Management.Deployment.Client.vcxproj index 035cf2e6f4..bd9367627f 100644 --- a/src/Microsoft.Management.Deployment.Client/Microsoft.Management.Deployment.Client.vcxproj +++ b/src/Microsoft.Management.Deployment.Client/Microsoft.Management.Deployment.Client.vcxproj @@ -57,6 +57,7 @@ v140 v141 v142 + v143 Unicode false true diff --git a/src/Microsoft.Management.Deployment.Server.Test/Microsoft.Management.Deployment.Server.Test.vcxproj b/src/Microsoft.Management.Deployment.Server.Test/Microsoft.Management.Deployment.Server.Test.vcxproj index c644266b9e..84961d9c0d 100644 --- a/src/Microsoft.Management.Deployment.Server.Test/Microsoft.Management.Deployment.Server.Test.vcxproj +++ b/src/Microsoft.Management.Deployment.Server.Test/Microsoft.Management.Deployment.Server.Test.vcxproj @@ -57,6 +57,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/Microsoft.Management.Deployment/Microsoft.Management.Deployment.vcxproj b/src/Microsoft.Management.Deployment/Microsoft.Management.Deployment.vcxproj index cc5df29c85..51da40e86c 100644 --- a/src/Microsoft.Management.Deployment/Microsoft.Management.Deployment.vcxproj +++ b/src/Microsoft.Management.Deployment/Microsoft.Management.Deployment.vcxproj @@ -56,6 +56,7 @@ v140 v141 v142 + v143 Unicode false diff --git a/src/WinGetServer/WinGetServer.vcxproj b/src/WinGetServer/WinGetServer.vcxproj index fc09844083..e97ba23714 100644 --- a/src/WinGetServer/WinGetServer.vcxproj +++ b/src/WinGetServer/WinGetServer.vcxproj @@ -57,6 +57,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/WinGetUtil/WinGetUtil.vcxproj b/src/WinGetUtil/WinGetUtil.vcxproj index 1a2451a3b4..c4e6e814cd 100644 --- a/src/WinGetUtil/WinGetUtil.vcxproj +++ b/src/WinGetUtil/WinGetUtil.vcxproj @@ -54,6 +54,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/YamlCppLib/YamlCppLib.vcxproj b/src/YamlCppLib/YamlCppLib.vcxproj index 8ab647d89b..2743df9e7f 100644 --- a/src/YamlCppLib/YamlCppLib.vcxproj +++ b/src/YamlCppLib/YamlCppLib.vcxproj @@ -82,6 +82,7 @@ v140 v141 v142 + v143 Unicode diff --git a/tools/SampleWinGetUWPCaller/AppInstallerCaller/AppInstallerCaller.vcxproj b/tools/SampleWinGetUWPCaller/AppInstallerCaller/AppInstallerCaller.vcxproj index 5e256b67ab..0d94a03b0e 100644 --- a/tools/SampleWinGetUWPCaller/AppInstallerCaller/AppInstallerCaller.vcxproj +++ b/tools/SampleWinGetUWPCaller/AppInstallerCaller/AppInstallerCaller.vcxproj @@ -57,6 +57,7 @@ v140 v141 v142 + v143 Unicode From dbdbdf76b6284ce87104dd7c9ad6952be6880447 Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Wed, 17 Nov 2021 14:54:05 -0500 Subject: [PATCH 2/4] Made the compiler less cranky. --- src/AppInstallerCLI/AppInstallerCLI.vcxproj | 1 + .../Workflows/ImportExportFlow.cpp | 2 +- src/AppInstallerCLITests/NameNormalization.cpp | 12 ++++++------ src/AppInstallerCLITests/YamlManifest.cpp | 2 +- src/AppInstallerCommonCore/Downloader.cpp | 6 ++++++ src/JsonCppLib/JsonCppLib.vcxproj | 14 +++++++++++--- src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj | 1 + src/cpprestsdk/cpprestsdk.vcxproj | 16 ++++++++++++---- 8 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/AppInstallerCLI/AppInstallerCLI.vcxproj b/src/AppInstallerCLI/AppInstallerCLI.vcxproj index 9622748291..5133cc7af0 100644 --- a/src/AppInstallerCLI/AppInstallerCLI.vcxproj +++ b/src/AppInstallerCLI/AppInstallerCLI.vcxproj @@ -54,6 +54,7 @@ v140 v141 v142 + v143 Unicode diff --git a/src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp b/src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp index b3c58852bb..f789c2bfec 100644 --- a/src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp @@ -163,7 +163,7 @@ namespace AppInstaller::CLI::Workflow void ReadImportFile(Execution::Context& context) { - std::ifstream importFile{ context.Args.GetArg(Execution::Args::Type::ImportFile) }; + std::ifstream importFile(std::string(context.Args.GetArg(Execution::Args::Type::ImportFile))); THROW_LAST_ERROR_IF(importFile.fail()); Json::Value jsonRoot; diff --git a/src/AppInstallerCLITests/NameNormalization.cpp b/src/AppInstallerCLITests/NameNormalization.cpp index 5e77185003..f45bf2f015 100644 --- a/src/AppInstallerCLITests/NameNormalization.cpp +++ b/src/AppInstallerCLITests/NameNormalization.cpp @@ -13,11 +13,11 @@ using namespace AppInstaller::Utility; // copy the file(s) back to the git managed location to update. TEST_CASE("NameNorm_Update_Database_Initial", "[.]") { - std::ifstream namesStream(TestCommon::TestDataFile("InputNames.txt")); + std::ifstream namesStream(TestCommon::TestDataFile("InputNames.txt").GetPath()); REQUIRE(namesStream); - std::ifstream publishersStream(TestCommon::TestDataFile("InputPublishers.txt")); + std::ifstream publishersStream(TestCommon::TestDataFile("InputPublishers.txt").GetPath()); REQUIRE(publishersStream); - std::ofstream resultsStream(TestCommon::TestDataFile("NormalizationInitialIdsUpdate.txt"), std::ofstream::out | std::ofstream::trunc | std::ofstream::binary); + std::ofstream resultsStream(TestCommon::TestDataFile("NormalizationInitialIdsUpdate.txt").GetPath(), std::ofstream::out | std::ofstream::trunc | std::ofstream::binary); REQUIRE(resultsStream); // Far larger than any one value; hopefully @@ -60,11 +60,11 @@ TEST_CASE("NameNorm_Update_Database_Initial", "[.]") // source. TEST_CASE("NameNorm_Database_Initial", "[name_norm]") { - std::ifstream namesStream(TestCommon::TestDataFile("InputNames.txt")); + std::ifstream namesStream(TestCommon::TestDataFile("InputNames.txt").GetPath()); REQUIRE(namesStream); - std::ifstream publishersStream(TestCommon::TestDataFile("InputPublishers.txt")); + std::ifstream publishersStream(TestCommon::TestDataFile("InputPublishers.txt").GetPath()); REQUIRE(publishersStream); - std::ifstream resultsStream(TestCommon::TestDataFile("NormalizationInitialIds.txt")); + std::ifstream resultsStream(TestCommon::TestDataFile("NormalizationInitialIds.txt").GetPath()); REQUIRE(resultsStream); // Far larger than any one value; hopefully diff --git a/src/AppInstallerCLITests/YamlManifest.cpp b/src/AppInstallerCLITests/YamlManifest.cpp index 279f539181..267dac1e74 100644 --- a/src/AppInstallerCLITests/YamlManifest.cpp +++ b/src/AppInstallerCLITests/YamlManifest.cpp @@ -122,7 +122,7 @@ TEST_CASE("ReadPreviewGoodManifestAndVerifyContents", "[ManifestValidation]") REQUIRE(localization1.Get() == "https://github.com/microsoft/msix-packaging/blob/master/LICENSE-es-MX"); // Stream hash - std::ifstream stream(manifestFile, std::ios_base::in | std::ios_base::binary); + std::ifstream stream(manifestFile.GetPath(), std::ios_base::in | std::ios_base::binary); REQUIRE(!stream.fail()); auto manifestHash = SHA256::ComputeHash(stream); REQUIRE(manifestHash.size() == manifest.StreamSha256.size()); diff --git a/src/AppInstallerCommonCore/Downloader.cpp b/src/AppInstallerCommonCore/Downloader.cpp index af5970e406..65093faa81 100644 --- a/src/AppInstallerCommonCore/Downloader.cpp +++ b/src/AppInstallerCommonCore/Downloader.cpp @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + #include "pch.h" #include "Public/AppInstallerErrors.h" #include "Public/AppInstallerRuntime.h" @@ -22,6 +23,9 @@ namespace AppInstaller::Utility IProgressCallback& progress, bool computeHash) { + // For AICLI_LOG usages with string literals. + #pragma warning(disable:26449) + AICLI_LOG(Core, Info, << "WinINet downloading from url: " << url); wil::unique_hinternet session(InternetOpenA( @@ -126,6 +130,8 @@ namespace AppInstaller::Utility AICLI_LOG(Core, Info, << "Download completed."); + #pragma warning(disable:26449) + return result; } diff --git a/src/JsonCppLib/JsonCppLib.vcxproj b/src/JsonCppLib/JsonCppLib.vcxproj index 56187d76d8..b381d73904 100644 --- a/src/JsonCppLib/JsonCppLib.vcxproj +++ b/src/JsonCppLib/JsonCppLib.vcxproj @@ -49,38 +49,45 @@ StaticLibrary true v142 + v143 StaticLibrary false v142 + v143 Spectre StaticLibrary true v142 + v143 StaticLibrary true v142 + v143 StaticLibrary true v142 + v143 StaticLibrary false v142 - Spectre + v143 + Spectre StaticLibrary false - v142 + v142 + v143 true @@ -93,7 +100,8 @@ StaticLibrary false v142 - Spectre + v143 + Spectre diff --git a/src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj b/src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj index 7a3d27b6bc..b04abbef2b 100644 --- a/src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj +++ b/src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj @@ -30,6 +30,7 @@ Application false v142 + v143 false Unicode diff --git a/src/cpprestsdk/cpprestsdk.vcxproj b/src/cpprestsdk/cpprestsdk.vcxproj index 8f0beed322..129dacf166 100644 --- a/src/cpprestsdk/cpprestsdk.vcxproj +++ b/src/cpprestsdk/cpprestsdk.vcxproj @@ -47,25 +47,29 @@ StaticLibrary true v142 + v143 Unicode StaticLibrary false v142 - Unicode + v143 + Unicode Spectre StaticLibrary true v142 - Unicode + v143 + Unicode StaticLibrary false v142 + v143 Unicode Spectre @@ -73,25 +77,29 @@ StaticLibrary true v142 - Unicode + v143 + Unicode StaticLibrary true v142 + v143 Unicode StaticLibrary false v142 - Unicode + v143 + Unicode Spectre StaticLibrary false v142 + v143 Unicode Spectre From bb275e1f2ea999181833950031f9264a324ec5e0 Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Thu, 18 Nov 2021 01:57:53 -0500 Subject: [PATCH 3/4] Forgot one. --- src/WindowsPackageManager/WindowsPackageManager.vcxproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WindowsPackageManager/WindowsPackageManager.vcxproj b/src/WindowsPackageManager/WindowsPackageManager.vcxproj index 80444562b7..8f2c5cc709 100644 --- a/src/WindowsPackageManager/WindowsPackageManager.vcxproj +++ b/src/WindowsPackageManager/WindowsPackageManager.vcxproj @@ -55,6 +55,7 @@ v140 v141 v142 + v143 Unicode From 29fc4cf4311c320db2b1ad60045be7d45769bd5e Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Thu, 18 Nov 2021 15:45:39 -0500 Subject: [PATCH 4/4] Applied suggestions from code review. --- src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp | 2 +- src/AppInstallerCommonCore/Downloader.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp b/src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp index f789c2bfec..c5263ec58b 100644 --- a/src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/ImportExportFlow.cpp @@ -163,7 +163,7 @@ namespace AppInstaller::CLI::Workflow void ReadImportFile(Execution::Context& context) { - std::ifstream importFile(std::string(context.Args.GetArg(Execution::Args::Type::ImportFile))); + std::ifstream importFile(Utility::ConvertToUTF16(context.Args.GetArg(Execution::Args::Type::ImportFile))); THROW_LAST_ERROR_IF(importFile.fail()); Json::Value jsonRoot; diff --git a/src/AppInstallerCommonCore/Downloader.cpp b/src/AppInstallerCommonCore/Downloader.cpp index 65093faa81..5f77cfdd14 100644 --- a/src/AppInstallerCommonCore/Downloader.cpp +++ b/src/AppInstallerCommonCore/Downloader.cpp @@ -24,6 +24,7 @@ namespace AppInstaller::Utility bool computeHash) { // For AICLI_LOG usages with string literals. + #pragma warning(push) #pragma warning(disable:26449) AICLI_LOG(Core, Info, << "WinINet downloading from url: " << url); @@ -130,7 +131,7 @@ namespace AppInstaller::Utility AICLI_LOG(Core, Info, << "Download completed."); - #pragma warning(disable:26449) + #pragma warning(pop) return result; }