diff --git a/dev/WindowsAppRuntime_UniversalBGTaskDLL/Task.cpp b/dev/WindowsAppRuntime_UniversalBGTaskDLL/Task.cpp index 72b235117d..4a28bfe527 100644 --- a/dev/WindowsAppRuntime_UniversalBGTaskDLL/Task.cpp +++ b/dev/WindowsAppRuntime_UniversalBGTaskDLL/Task.cpp @@ -3,9 +3,7 @@ #include "pch.h" #include "Task.h" -#if __has_include("Task.g.cpp") #include "Task.g.cpp" -#endif using namespace winrt; using namespace winrt::Windows::ApplicationModel::Background; @@ -13,17 +11,18 @@ using namespace winrt::Windows::Storage; namespace winrt::Microsoft::Windows::ApplicationModel::Background::UniversalBGTask::implementation { - inline constexpr CLSID IID_IBackgroundTask = { 2098451764, 64786, 17358, 140, 34, 234, 31, 241, 60, 6, 223 }; + inline constexpr CLSID IID_IBackgroundTask{ 2098451764, 64786, 17358, 140, 34, 234, 31, 241, 60, 6, 223 }; + void Task::Run(winrt::Windows::ApplicationModel::Background::IBackgroundTaskInstance taskInstance) { - winrt::hstring lookupStr = winrt::to_hstring(taskInstance.Task().TaskId()); - ApplicationDataContainer localSettings = ApplicationData::Current().LocalSettings(); - auto values = localSettings.Values(); - auto lookupobj = values.Lookup(lookupStr); - winrt::guid comClsId = winrt::unbox_value(lookupobj); + winrt::hstring lookupKey{ winrt::to_hstring(taskInstance.Task().TaskId()) }; + ApplicationDataContainer localSettings{ ApplicationData::Current().LocalSettings() }; + auto values{ localSettings.Values() }; + auto lookupValue{ values.Lookup(lookupKey) }; + winrt::guid comClsId{ winrt::unbox_value(lookupValue) }; - winrt::Windows::ApplicationModel::Background::IBackgroundTask bgTask = nullptr; - winrt::hresult hr = CoCreateInstance(comClsId, nullptr, CLSCTX_LOCAL_SERVER, IID_IBackgroundTask, reinterpret_cast(&bgTask)); + winrt::Windows::ApplicationModel::Background::IBackgroundTask bgTask; + winrt::hresult hr{ CoCreateInstance(comClsId, nullptr, CLSCTX_LOCAL_SERVER, IID_IBackgroundTask, reinterpret_cast(&bgTask)) }; bgTask.Run(taskInstance); } } diff --git a/dev/WindowsAppRuntime_UniversalBGTaskDLL/Task.idl b/dev/WindowsAppRuntime_UniversalBGTaskDLL/Task.idl index bcc31e8c74..326df8b8e1 100644 --- a/dev/WindowsAppRuntime_UniversalBGTaskDLL/Task.idl +++ b/dev/WindowsAppRuntime_UniversalBGTaskDLL/Task.idl @@ -1,10 +1,12 @@ // Copyright (c) Microsoft Corporation and Contributors. // Licensed under the MIT License. - - namespace Microsoft.Windows.ApplicationModel.Background.UniversalBGTask { + [contractversion(1)] + apicontract UniversalBGTaskContract{}; + + [contract(UniversalBGTaskContract, 1)] [default_interface] runtimeclass Task : Windows.ApplicationModel.Background.IBackgroundTask { diff --git a/dev/WindowsAppRuntime_UniversalBGTaskDLL/WindowsAppRuntime_UniversalBGTaskDLL.def b/dev/WindowsAppRuntime_UniversalBGTaskDLL/WindowsAppRuntime_UniversalBGTaskDLL.def index d04a02ea81..0e3b54f49a 100644 --- a/dev/WindowsAppRuntime_UniversalBGTaskDLL/WindowsAppRuntime_UniversalBGTaskDLL.def +++ b/dev/WindowsAppRuntime_UniversalBGTaskDLL/WindowsAppRuntime_UniversalBGTaskDLL.def @@ -1,3 +1,6 @@ +; Copyright (c) Microsoft Corporation. All rights reserved. +; Licensed under the MIT License. See LICENSE in the project root for license information. + EXPORTS DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE diff --git a/dev/WindowsAppRuntime_UniversalBGTaskDLL/WindowsAppRuntime_UniversalBGTaskDLL.vcxproj b/dev/WindowsAppRuntime_UniversalBGTaskDLL/WindowsAppRuntime_UniversalBGTaskDLL.vcxproj index 241cc92f61..62b8914e26 100644 --- a/dev/WindowsAppRuntime_UniversalBGTaskDLL/WindowsAppRuntime_UniversalBGTaskDLL.vcxproj +++ b/dev/WindowsAppRuntime_UniversalBGTaskDLL/WindowsAppRuntime_UniversalBGTaskDLL.vcxproj @@ -1,23 +1,7 @@ - - - - - true - true - true - {0c4405e6-029e-4363-8273-a9e1fcf057de} - Microsoft.Windows.ApplicationModel.Background.UniversalBGTask - en-US - 16.0 - false - 10.0 - 10.0 - true - true - + Debug @@ -44,12 +28,22 @@ ARM64 + + 16.0 + {0c4405e6-029e-4363-8273-a9e1fcf057de} + Win32Proj + Microsoft.Windows.ApplicationModel.Background.UniversalBGTask + 10.0 + true + true + true + true + 9 + DynamicLibrary v143 Unicode - false - true true @@ -91,15 +85,9 @@ Use pch.h - $(IntDir)pch.pch - Level4 - %(AdditionalOptions) /bigobj - _WINRT_DLL;%(PreprocessorDefinitions) - $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) - Console - true + Windows WindowsAppRuntime_UniversalBGTaskDLL.def @@ -112,10 +100,6 @@ NDEBUG;%(PreprocessorDefinitions) - - true - true - @@ -140,11 +124,6 @@ - - - false - - $(RepoRoot);%(AdditionalIncludeDirectories) @@ -152,21 +131,13 @@ - - - - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - + + - \ No newline at end of file + diff --git a/dev/WindowsAppRuntime_UniversalBGTaskDLL/packages.config b/dev/WindowsAppRuntime_UniversalBGTaskDLL/packages.config index df5f654653..315eb1aca6 100644 --- a/dev/WindowsAppRuntime_UniversalBGTaskDLL/packages.config +++ b/dev/WindowsAppRuntime_UniversalBGTaskDLL/packages.config @@ -1,7 +1,4 @@ - - - - \ No newline at end of file + diff --git a/dev/WindowsAppRuntime_UniversalBGTaskDLL/pch.h b/dev/WindowsAppRuntime_UniversalBGTaskDLL/pch.h index 5a962aa2dc..5a9e6e458a 100644 --- a/dev/WindowsAppRuntime_UniversalBGTaskDLL/pch.h +++ b/dev/WindowsAppRuntime_UniversalBGTaskDLL/pch.h @@ -2,29 +2,9 @@ // Licensed under the MIT License. #pragma once -#include -#include -#include -#include -// Undefine GetCurrentTime macro to prevent -// conflict with Storyboard::GetCurrentTime -#undef GetCurrentTime +#include #include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/dev/WindowsAppRuntime_UniversalBGTaskDLL/readme.txt b/dev/WindowsAppRuntime_UniversalBGTaskDLL/readme.txt deleted file mode 100644 index 312359a40d..0000000000 --- a/dev/WindowsAppRuntime_UniversalBGTaskDLL/readme.txt +++ /dev/null @@ -1,27 +0,0 @@ -======================================================================== - WindowsAppRuntime_UniversalBGTaskDLL Project Overview -======================================================================== - -This project demonstrates how to get started authoring Windows Runtime -classes directly with standard C++, using the Windows App SDK and -C++/WinRT packages to generate implementation headers from interface -(IDL) files. The generated Windows Runtime component binary and WinMD -files should then be bundled with the app consuming them. - -Steps: -1. Create an interface (IDL) file to define your Windows Runtime class, - its default interface, and any other interfaces it implements. -2. Build the project once to generate module.g.cpp, module.h.cpp, and - implementation templates under the "Generated Files" folder, as - well as skeleton class definitions under "Generated Files\sources". -3. Use the skeleton class definitions for reference to implement your - Windows Runtime classes. - -======================================================================== -Learn more about Windows App SDK here: -https://docs.microsoft.com/windows/apps/windows-app-sdk/ -Learn more about WinUI3 here: -https://docs.microsoft.com/windows/apps/winui/winui3/ -Learn more about C++/WinRT here: -http://aka.ms/cppwinrt/ -======================================================================== diff --git a/docs/Coding-Guidelines/GettingStarted.md b/docs/Coding-Guidelines/GettingStarted.md index b5b5aa15cf..a0ec95b5cd 100644 --- a/docs/Coding-Guidelines/GettingStarted.md +++ b/docs/Coding-Guidelines/GettingStarted.md @@ -52,6 +52,7 @@ or via the browser: * Windows 10 SDK (10.0.20348.0) * Windows 10 SDK (10.0.22000.0) * Windows 10 SDK (10.0.22621.0) + * Windows 10 SDK (10.0.26100.0) * Windows Universal C Runtime * and more! See [VisualStudio2022.vsconfig](https://github.com/microsoft/WindowsAppSDK/blob/develop/docs/Coding-Guidelines/VisualStudio2022.vsconfig) for the complete list diff --git a/docs/Coding-Guidelines/VisualStudio2022.vsconfig b/docs/Coding-Guidelines/VisualStudio2022.vsconfig index 9992a03d1d..77386b14e8 100644 --- a/docs/Coding-Guidelines/VisualStudio2022.vsconfig +++ b/docs/Coding-Guidelines/VisualStudio2022.vsconfig @@ -41,7 +41,6 @@ "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", "Microsoft.VisualStudio.Component.Graphics.Tools", "Microsoft.VisualStudio.Component.VC.DiagnosticTools", - "Microsoft.VisualStudio.Component.Windows10SDK.19041", "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites", "Microsoft.ComponentGroup.Blend", "Microsoft.VisualStudio.Component.DotNetModelBuilder", @@ -57,7 +56,9 @@ "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest", "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest", "Microsoft.VisualStudio.Component.VC.ASAN", + "Microsoft.VisualStudio.Component.Windows11SDK.26100", "Microsoft.VisualStudio.Component.Windows11SDK.22000", + "Microsoft.VisualStudio.Component.Windows10SDK.19041", "Microsoft.VisualStudio.Component.Windows10SDK.18362", "Microsoft.VisualStudio.Component.VC.Tools.ARM64EC", "Microsoft.VisualStudio.Workload.NativeDesktop", diff --git a/tools/DevCheck/DevCheck.ps1 b/tools/DevCheck/DevCheck.ps1 index e3b0010f8b..2eaa74545a 100644 --- a/tools/DevCheck/DevCheck.ps1 +++ b/tools/DevCheck/DevCheck.ps1 @@ -163,6 +163,7 @@ Set-StrictMode -Version 3.0 $ErrorActionPreference = "Stop" $global:issues = 0 +$global:issues_test_certificate_thumbprint_not_found = 0 $global:isadmin = $null @@ -171,6 +172,11 @@ $global:vswhere_url = '' $global:dependency_paths = ('dev', 'test', 'installer', 'tools') +function Get-Issues +{ + return $global:issues + $global:issues_test_certificate_thumbprint_not_found +} + function Get-SettingsFile { if ([string]::IsNullOrEmpty($SettingsFile)) @@ -700,7 +706,7 @@ function Test-WindowsSDKInstall } elseif ($InstallWindowsSDK -eq $true) { - Write-Warning "WARNING: Windows SDK $($version) not found. Installing..." + Write-Warning "Windows SDK $($version) not found. Installing..." $null = Install-WindowsSDK $version $url } else @@ -723,7 +729,7 @@ function Test-DevTestPfx if (-not(Test-Path -Path $pfx_thumbprint -PathType Leaf)) { Write-Host "Test certificate thumbprint $pfx_thumbprint...Not Found" - $global:issues++ + $global:issues_test_certificate_thumbprint_not_found = 1 return $false } @@ -841,7 +847,7 @@ function Repair-DevTestPfx $pfx = Join-Path $user 'winappsdk.certificate.test.pfx' $export_pfx = Export-PfxCertificate -Cert $cert_personal -FilePath $pfx -Password $password - # Delete the personal certiicate + # Delete the personal certificate Remove-Item -Path $cert_personal -DeleteKey $ok = $true @@ -997,12 +1003,12 @@ function Test-TAEFServiceVersion if ($cmp -lt 0) { - Write-Warning "WARNING: TAEF service older than the expected version (expected=$expected_taef_version, actual=$actual_taef_version)" + Write-Warning "TAEF service older than the expected version (expected=$expected_taef_version, actual=$actual_taef_version)" return 'OlderVersion' } elseif ($cmp -gt 0) { - Write-Warning "WARNING: TAEF service newer than the expected version (expected=$expected_taef_version, actual=$actual_taef_version)" + Write-Warning "TAEF service newer than the expected version (expected=$expected_taef_version, actual=$actual_taef_version)" return 'NewerVersion' } else @@ -1617,7 +1623,7 @@ if (($CheckAll -ne $false) -Or ($CheckVisualStudio -ne $false)) $null = Test-VisualStudioComponents } $null = Test-WindowsSDKInstall '10.0.17763.0' [uri]'https://go.microsoft.com/fwlink/p/?LinkID=2033908' - #TODO Uncomment to require new SDK: $null = Test-WindowsSDKInstall '10.0.26100.0' [uri]'https://go.microsoft.com/fwlink/?linkid=2272610' + $null = Test-WindowsSDKInstall '10.0.26100.0' [uri]'https://go.microsoft.com/fwlink/?linkid=2272610' } if (($CheckAll -ne $false) -Or ($CheckTestPfx -ne $false)) @@ -1706,12 +1712,15 @@ if (($RemoveAll -ne $false) -Or ($RemoveTestPfx -ne $false)) $null = Remove-DevTestPfx } -if ($global:issues -eq 0) +$issues_count = Get-Issues +if ($issues_count -eq 0) { Write-Output "Coding time!" + Exit 0 } else { - $n = $global:issues + $n = $issues_count Write-Output "$n issue(s) detected" + Exit 1 }