From f9ab52c613053a76668294fea48f84d9734ae77d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 20 Nov 2024 16:46:24 -0800 Subject: [PATCH 01/14] Remove .NET 6 target from all projects --- .../CsWinRT-Benchmarks-Steps.yml | 13 ------- .../CsWinRT-Build-Steps.yml | 38 ++++--------------- .../CsWinRT-BuildAndTest-Stage.yml | 7 +--- .../CsWinRT-PublishToMaestro-Stage.yml | 2 +- .../CsWinRT-PublishToNuget-Stage.yml | 31 ++++++--------- .../CsWinRT-Variables.yml | 2 - docs/authoring.md | 6 +-- docs/embedded.md | 2 +- ...icrosoft.Windows.CsWinRT.Authoring.targets | 4 +- ...Microsoft.Windows.CsWinRT.Embedded.targets | 3 +- nuget/Microsoft.Windows.CsWinRT.nuspec | 13 +++---- nuget/Microsoft.Windows.CsWinRT.targets | 8 ++-- .../WinRT.Host.Shim/WinRT.Host.Shim.csproj | 2 +- src/Authoring/WinRT.Host/NetHostDir.csproj | 2 +- src/Authoring/cswinmd/CsWinMD.csproj | 2 +- src/Directory.Build.props | 20 +++++----- src/Perf/IIDOptimizer/IIDOptimizer.csproj | 2 +- .../ResultsComparer/ResultsComparer.csproj | 2 +- .../AuthoringDemo/AuthoringDemo.csproj | 2 +- .../BgTaskComponent/BgTaskComponent.csproj | 2 +- .../WinRT.Host.runtimeconfig.json | 4 +- .../BgTaskComponent/WpfApp/WpfApp.csproj | 4 +- .../ConsoleAppSample/ConsoleAppSample.csproj | 2 +- .../SimpleMathProjection.csproj | 2 +- .../nuget/SimpleMathProjection.nuspec | 11 +++--- .../Net6App.Bootstrap.csproj | 2 +- .../TestEmbedded/Net6App.Bootstrap/Program.cs | 2 +- .../TestEmbedded/Net6App/Net6App.csproj | 2 +- .../Net6App/Properties/launchSettings.json | 2 +- src/Samples/TestEmbedded/README.md | 10 ++--- src/Samples/TestEmbedded/TestEmbedded.sln | 4 +- .../TestEmbeddedLibrary.csproj | 2 +- .../UnitTestEmbedded/UnitTestEmbedded.csproj | 2 +- src/Samples/TestEmbedded/clean.cmd | 4 +- .../WinUIDesktopSample.csproj | 2 +- .../AuthoringConsumptionTest.vcxproj | 2 +- .../AuthoringWinUITest.vcxproj | 8 ++-- .../AuthoringWuxConsumptionTest.vcxproj | 10 ++--- .../WinRT.Host.runtimeconfig.json | 2 +- .../AuthoringWuxTest/AuthoringWuxTest.csproj | 2 +- .../CSWinMDComponent/CSWinMDComponent.vcxproj | 2 +- .../BadMappedTarget.Host.runtimeconfig.json | 2 +- .../ClassNotFound.Host.runtimeconfig.json | 2 +- src/Tests/HostTest/HostTest.vcxproj | 10 ++--- .../MappedTarget.Host.runtimeconfig.json | 2 +- .../HostTest/RuntimeFrameworkVersion.csproj | 2 +- .../HostTest/Test.Host.runtimeconfig.json | 4 +- .../HostTest/WinRT.Host.runtimeconfig.json | 4 +- .../EventRegistrationTokenTable{T}.cs | 14 +++---- src/WinRT.Runtime/Platform.cs | 8 ++-- src/WinRT.Runtime/WinRT.Runtime.csproj | 14 +++---- src/benchmark.cmd | 4 +- src/build.cmd | 13 +++---- src/cswinrt/main.cpp | 7 +++- 54 files changed, 137 insertions(+), 193 deletions(-) diff --git a/build/AzurePipelineTemplates/CsWinRT-Benchmarks-Steps.yml b/build/AzurePipelineTemplates/CsWinRT-Benchmarks-Steps.yml index 8a22088a7..f9f763810 100644 --- a/build/AzurePipelineTemplates/CsWinRT-Benchmarks-Steps.yml +++ b/build/AzurePipelineTemplates/CsWinRT-Benchmarks-Steps.yml @@ -29,19 +29,6 @@ steps: env: PROCESSOR_ARCHITECTURE: x86 -# Install .NET 6 SDK -- task: PowerShell@2 - displayName: Install .NET 6 SDK - inputs: - targetType: inline - failOnStderr: true - script: | - Write-Host ##vso[task.setvariable variable=PATH;]${env:LocalAppData}\Microsoft\dotnet;${env:PATH}; - - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; - - &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version "$($env:NET6_SDK_VERSION)" -Architecture "x64" -AzureFeed "$($env:NET5_SDK_FEED)" - # Install .NET 8 SDK - task: PowerShell@2 displayName: Install .NET 8 SDK diff --git a/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml b/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml index db5d0c9ec..9ff4a279f 100644 --- a/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml +++ b/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml @@ -51,19 +51,6 @@ steps: env: PROCESSOR_ARCHITECTURE: x86 -# Install .NET 6 SDK -- task: PowerShell@2 - displayName: Install .NET 6 SDK - inputs: - targetType: inline - failOnStderr: true - script: | - Write-Host ##vso[task.setvariable variable=PATH;]${env:LocalAppData}\Microsoft\dotnet;${env:PATH}; - - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; - - &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version "$($env:NET6_SDK_VERSION)" -Architecture "x64" -AzureFeed "$($env:NET5_SDK_FEED)" - # Install .NET 8 SDK - task: PowerShell@2 displayName: Install .NET 8 SDK @@ -261,7 +248,7 @@ steps: displayName: Stage Unit Test condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildPlatform'], 'x64'))) inputs: - SourceFolder: $(Build.SourcesDirectory)\src\Tests\UnitTest\bin\$(BuildPlatform)\$(BuildConfiguration)\net6.0 + SourceFolder: $(Build.SourcesDirectory)\src\Tests\UnitTest\bin\$(BuildPlatform)\$(BuildConfiguration)\net8.0 Contents: | unittest.dll unittest.pdb @@ -289,17 +276,6 @@ steps: WinRT.SourceGenerator.pdb TargetFolder: $(Build.ArtifactStagingDirectory)\release_netstandard2.0\ -# Stage Net6.0 -- task: CopyFiles@2 - displayName: Stage Net6.0 - condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')) - inputs: - SourceFolder: $(Build.SourcesDirectory)\src\WinRT.Runtime\bin\$(BuildConfiguration)\net6.0 - Contents: | - WinRT.Runtime.dll - WinRT.Runtime.pdb - TargetFolder: $(Build.ArtifactStagingDirectory)\release_net6.0 - # Stage Net8.0 - task: CopyFiles@2 displayName: Stage Net8.0 @@ -317,11 +293,11 @@ steps: condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')) continueOnError: True inputs: - SourceFolder: $(Build.SourcesDirectory)\src\Authoring\WinRT.Host.Shim\bin\$(BuildConfiguration)\net6.0 + SourceFolder: $(Build.SourcesDirectory)\src\Authoring\WinRT.Host.Shim\bin\$(BuildConfiguration)\net8.0 Contents: | WinRT.Host.Shim.dll WinRT.Host.Shim.pdb - TargetFolder: $(Build.ArtifactStagingDirectory)\release_net6.0 + TargetFolder: $(Build.ArtifactStagingDirectory)\release_net8.0 # Stage IID Optimizer - task: CopyFiles@2 @@ -329,7 +305,7 @@ steps: condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')) continueOnError: True inputs: - SourceFolder: $(Build.SourcesDirectory)\src\Perf\IIDOptimizer\bin\$(BuildConfiguration)\net6.0 + SourceFolder: $(Build.SourcesDirectory)\src\Perf\IIDOptimizer\bin\$(BuildConfiguration)\net8.0 Contents: | IIDOptimizer.exe IIDOptimizer.dll @@ -353,7 +329,7 @@ steps: tr/System.CommandLine.resources.dll zh-Hans/System.CommandLine.resources.dll zh-Hant/System.CommandLine.resources.dll - TargetFolder: $(Build.ArtifactStagingDirectory)\release_net6.0\IIDOptimizer + TargetFolder: $(Build.ArtifactStagingDirectory)\release_net8.0\IIDOptimizer # Stage WinRT.Runtime ResX - task: CopyFiles@2 @@ -380,7 +356,7 @@ steps: displayName: Stage CsWinMD condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')) inputs: - SourceFolder: $(Build.SourcesDirectory)\src\Authoring\cswinmd\bin\$(BuildConfiguration)\net6.0 + SourceFolder: $(Build.SourcesDirectory)\src\Authoring\cswinmd\bin\$(BuildConfiguration)\net8.0 Contents: | CsWinMD.dll CsWinMD.exe @@ -389,4 +365,4 @@ steps: CsWinMD.runtimeconfig.json Microsoft.CodeAnalysis.CSharp.dll Microsoft.CodeAnalysis.dll - TargetFolder: $(Build.ArtifactStagingDirectory)\release_net6.0\CsWinMD + TargetFolder: $(Build.ArtifactStagingDirectory)\release_net8.0\CsWinMD diff --git a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml index 3b7e4edff..eaac307db 100644 --- a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml +++ b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml @@ -77,7 +77,7 @@ stages: displayName: Run Object Lifetime Tests condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildPlatform'], 'x64'))) inputs: - testAssemblyVer2: Tests\ObjectLifetimeTests\bin\$(BuildPlatform)\$(BuildConfiguration)\net6.0-windows10.0.19041.0\win10-$(BuildPlatform)\ObjectLifetimeTests.Lifted.build.appxrecipe + testAssemblyVer2: Tests\ObjectLifetimeTests\bin\$(BuildPlatform)\$(BuildConfiguration)\net8.0-windows10.0.19041.0\win10-$(BuildPlatform)\ObjectLifetimeTests.Lifted.build.appxrecipe searchFolder: $(Build.SourcesDirectory)\src # Run Host Tests @@ -173,11 +173,6 @@ stages: condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')) targetPath: $(Build.ArtifactStagingDirectory)\resx artifactName: ResX - - output: pipelineArtifact - displayName: 'Publish Net6.0' - condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')) - targetPath: $(Build.ArtifactStagingDirectory)\release_net6.0 - artifactName: net6.0 - output: pipelineArtifact displayName: 'Publish Net8.0' condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')) diff --git a/build/AzurePipelineTemplates/CsWinRT-PublishToMaestro-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-PublishToMaestro-Stage.yml index 22fe47926..61b4bb52d 100644 --- a/build/AzurePipelineTemplates/CsWinRT-PublishToMaestro-Stage.yml +++ b/build/AzurePipelineTemplates/CsWinRT-PublishToMaestro-Stage.yml @@ -42,4 +42,4 @@ stages: - template: ..\..\eng\common\AzurePipelineTemplates\Maestro-PublishBuildToMaestro-Steps.yml@self parameters: AssetNames: Microsoft.Windows.CsWinRT;CsWinRT.Dependency.DotNetCoreSdk;CsWinRT.Dependency.DotNetCoreRuntime;CsWinRT.Dependency.WindowsSdkVersionSuffix - AssetVersions: $(NugetVersion);$(Net6.Sdk.Version);$(_DotNetRuntimeVersion);$(_WindowsSdkVersionSuffix) \ No newline at end of file + AssetVersions: $(NugetVersion);$(Net8.Sdk.Version);$(_DotNetRuntimeVersion);$(_WindowsSdkVersionSuffix) \ No newline at end of file diff --git a/build/AzurePipelineTemplates/CsWinRT-PublishToNuget-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-PublishToNuget-Stage.yml index 6d22b2d48..fb692d7c5 100644 --- a/build/AzurePipelineTemplates/CsWinRT-PublishToNuget-Stage.yml +++ b/build/AzurePipelineTemplates/CsWinRT-PublishToNuget-Stage.yml @@ -57,14 +57,6 @@ stages: itemPattern: '' targetPath: $(Build.SourcesDirectory)\netstandard2.0 -# Download Net6.0 - - task: DownloadPipelineArtifact@2 - displayName: 'Download Net6.0' - inputs: - artifactName: net6.0 - itemPattern: '' - targetPath: $(Build.SourcesDirectory)\net6.0 - # Download Net8.0 - task: DownloadPipelineArtifact@2 displayName: 'Download Net8.0' @@ -99,8 +91,7 @@ stages: netstandard2.0\WinRT.Runtime.dll netstandard2.0\WinRT.Host.Shim.dll netstandard2.0\WinRT.SourceGenerator.dll - net6.0\WinRT.Host.Shim.dll - net6.0\WinRT.Runtime.dll + net8.0\WinRT.Host.Shim.dll net8.0\WinRT.Runtime.dll release_x64\WinRT.Host.dll release_x64\WinRT.Host.dll.mui @@ -108,10 +99,10 @@ stages: release_x86\WinRT.Host.dll.mui release_arm64\WinRT.Host.dll release_arm64\WinRT.Host.dll.mui - net6.0\IIDOptimizer\IIDOptimizer.exe - net6.0\IIDOptimizer\IIDOptimizer.dll - net6.0\CsWinMD\CsWinMD.exe - net6.0\CsWinMD\CsWinMD.dll + net8.0\IIDOptimizer\IIDOptimizer.exe + net8.0\IIDOptimizer\IIDOptimizer.dll + net8.0\CsWinMD\CsWinMD.exe + net8.0\CsWinMD\CsWinMD.dll UseMinimatch: true signConfigType: inlineSignParams inlineOperation: | @@ -159,10 +150,10 @@ stages: AuthSignCertName: $(SigningSignCertName) FolderPath: $(Build.SourcesDirectory) Pattern: | - net6.0\IIDOptimizer\Mono.Cecil.dll - net6.0\IIDOptimizer\Mono.Cecil.Mdb.dll - net6.0\IIDOptimizer\Mono.Cecil.Pdb.dll - net6.0\IIDOptimizer\Mono.Cecil.Rocks.dll + net8.0\IIDOptimizer\Mono.Cecil.dll + net8.0\IIDOptimizer\Mono.Cecil.Mdb.dll + net8.0\IIDOptimizer\Mono.Cecil.Pdb.dll + net8.0\IIDOptimizer\Mono.Cecil.Rocks.dll UseMinimatch: true signConfigType: inlineSignParams inlineOperation: | @@ -230,7 +221,7 @@ stages: command: pack searchPatternPack: nuget/Microsoft.Windows.CsWinRT.nuspec configurationToPack: Release - buildProperties: cswinrt_nuget_version=$(NugetVersion);cswinrt_exe=$(Build.SourcesDirectory)\cswinrt.exe;interop_winmd=$(Build.SourcesDirectory)\WinRT.Interop.winmd;netstandard2_runtime=$(Build.SourcesDirectory)\netstandard2.0\WinRT.Runtime.dll;net6_runtime=$(Build.SourcesDirectory)\net6.0\WinRT.Runtime.dll;net8_runtime=$(Build.SourcesDirectory)\net8.0\WinRT.Runtime.dll;source_generator=$(Build.SourcesDirectory)\netstandard2.0\WinRT.SourceGenerator.dll;winrt_shim=$(Build.SourcesDirectory)\net6.0\WinRT.Host.Shim.dll;winrt_host_x86=$(Build.SourcesDirectory)\release_x86\WinRT.Host.dll;winrt_host_x64=$(Build.SourcesDirectory)\release_x64\WinRT.Host.dll;winrt_host_arm64=$(Build.SourcesDirectory)\release_arm64\WinRT.Host.dll;winrt_host_resource_x86=$(Build.SourcesDirectory)\release_x86\WinRT.Host.dll.mui;winrt_host_resource_x64=$(Build.SourcesDirectory)\release_x64\WinRT.Host.dll.mui;winrt_host_resource_arm64=$(Build.SourcesDirectory)\release_arm64\WinRT.Host.dll.mui;guid_patch=$(Build.SourcesDirectory)\net6.0\IIDOptimizer\*.* + buildProperties: cswinrt_nuget_version=$(NugetVersion);cswinrt_exe=$(Build.SourcesDirectory)\cswinrt.exe;interop_winmd=$(Build.SourcesDirectory)\WinRT.Interop.winmd;netstandard2_runtime=$(Build.SourcesDirectory)\netstandard2.0\WinRT.Runtime.dll;net8_runtime=$(Build.SourcesDirectory)\net8.0\WinRT.Runtime.dll;source_generator=$(Build.SourcesDirectory)\netstandard2.0\WinRT.SourceGenerator.dll;winrt_shim=$(Build.SourcesDirectory)\net8.0\WinRT.Host.Shim.dll;winrt_host_x86=$(Build.SourcesDirectory)\release_x86\WinRT.Host.dll;winrt_host_x64=$(Build.SourcesDirectory)\release_x64\WinRT.Host.dll;winrt_host_arm64=$(Build.SourcesDirectory)\release_arm64\WinRT.Host.dll;winrt_host_resource_x86=$(Build.SourcesDirectory)\release_x86\WinRT.Host.dll.mui;winrt_host_resource_x64=$(Build.SourcesDirectory)\release_x64\WinRT.Host.dll.mui;winrt_host_resource_arm64=$(Build.SourcesDirectory)\release_arm64\WinRT.Host.dll.mui;guid_patch=$(Build.SourcesDirectory)\net8.0\IIDOptimizer\*.* - task: NuGetCommand@2 displayName: NuGet pack @@ -239,7 +230,7 @@ stages: command: pack searchPatternPack: nuget/Microsoft.Windows.CsWinMD.nuspec configurationToPack: Release - buildProperties: cswinmd_nuget_version=$(NugetVersion);cswinmd_outpath=$(Build.SourcesDirectory)\net6.0\CsWinMD;source_generator=$(Build.SourcesDirectory)\netstandard2.0\WinRT.SourceGenerator.dll + buildProperties: cswinmd_nuget_version=$(NugetVersion);cswinmd_outpath=$(Build.SourcesDirectory)\net8.0\CsWinMD;source_generator=$(Build.SourcesDirectory)\netstandard2.0\WinRT.SourceGenerator.dll # ESRP CodeSigning - task: EsrpCodeSigning@5 diff --git a/build/AzurePipelineTemplates/CsWinRT-Variables.yml b/build/AzurePipelineTemplates/CsWinRT-Variables.yml index 4d0ae9e39..66232cf79 100644 --- a/build/AzurePipelineTemplates/CsWinRT-Variables.yml +++ b/build/AzurePipelineTemplates/CsWinRT-Variables.yml @@ -10,8 +10,6 @@ variables: value: '2.2.0.0' - name: Net5.SDK.Feed value: 'https://dotnetcli.blob.core.windows.net/dotnet' -- name: Net6.SDK.Version - value: '6.0.424' - name: Net8.SDK.Version value: '8.0.303' - name: NoSamples diff --git a/docs/authoring.md b/docs/authoring.md index 7888b16df..5509a3864 100644 --- a/docs/authoring.md +++ b/docs/authoring.md @@ -15,7 +15,7 @@ It is recommended to use .NET 6 and Visual Studio 2022 for C#/WinRT authoring sc ```xml - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 ``` @@ -66,9 +66,9 @@ To make your component available as a NuGet package, it is important to include target="build\MyAuthoredComponent.targets" /> - - diff --git a/docs/embedded.md b/docs/embedded.md index b0c4f5409..0e72c6578 100644 --- a/docs/embedded.md +++ b/docs/embedded.md @@ -47,7 +47,7 @@ Here is an example project file for a library cross-targeting and embedding a C# - net6.0-windows;net5.0-windows;netstandard2.0 + net8.0-windows;net5.0-windows;netstandard2.0 x64;x86 diff --git a/nuget/Microsoft.Windows.CsWinRT.Authoring.targets b/nuget/Microsoft.Windows.CsWinRT.Authoring.targets index 7d4ad4bd1..571db1482 100644 --- a/nuget/Microsoft.Windows.CsWinRT.Authoring.targets +++ b/nuget/Microsoft.Windows.CsWinRT.Authoring.targets @@ -62,7 +62,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. --> - + WinRT.Host.Shim.dll PreserveNewest @@ -284,7 +284,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. --> - + true lib\$(TargetFramework) diff --git a/nuget/Microsoft.Windows.CsWinRT.Embedded.targets b/nuget/Microsoft.Windows.CsWinRT.Embedded.targets index 5fdac7141..dc61b1898 100644 --- a/nuget/Microsoft.Windows.CsWinRT.Embedded.targets +++ b/nuget/Microsoft.Windows.CsWinRT.Embedded.targets @@ -16,7 +16,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. - + @@ -68,7 +68,6 @@ Copyright (C) Microsoft Corporation. All rights reserved. - diff --git a/nuget/Microsoft.Windows.CsWinRT.nuspec b/nuget/Microsoft.Windows.CsWinRT.nuspec index 32e0dfcff..d4c2c67ea 100644 --- a/nuget/Microsoft.Windows.CsWinRT.nuspec +++ b/nuget/Microsoft.Windows.CsWinRT.nuspec @@ -14,7 +14,7 @@ LICENSE https://github.com/microsoft/cswinrt - + @@ -30,13 +30,12 @@ - - + - + - + - + diff --git a/nuget/Microsoft.Windows.CsWinRT.targets b/nuget/Microsoft.Windows.CsWinRT.targets index 876338f3c..4e0203a83 100644 --- a/nuget/Microsoft.Windows.CsWinRT.targets +++ b/nuget/Microsoft.Windows.CsWinRT.targets @@ -124,16 +124,16 @@ Copyright (C) Microsoft Corporation. All rights reserved. - $(CsWinRTPath)lib\net6.0 + $(CsWinRTPath)lib\net8.0 $(CsWinRTPath)runtimes\**\native - - - + + + diff --git a/src/Authoring/WinRT.Host.Shim/WinRT.Host.Shim.csproj b/src/Authoring/WinRT.Host.Shim/WinRT.Host.Shim.csproj index fb24df655..25fb7c1c1 100644 --- a/src/Authoring/WinRT.Host.Shim/WinRT.Host.Shim.csproj +++ b/src/Authoring/WinRT.Host.Shim/WinRT.Host.Shim.csproj @@ -1,7 +1,7 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 diff --git a/src/Authoring/WinRT.Host/NetHostDir.csproj b/src/Authoring/WinRT.Host/NetHostDir.csproj index 341d68e52..9b566979e 100644 --- a/src/Authoring/WinRT.Host/NetHostDir.csproj +++ b/src/Authoring/WinRT.Host/NetHostDir.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Authoring/cswinmd/CsWinMD.csproj b/src/Authoring/cswinmd/CsWinMD.csproj index 3f0a027ad..32521a5cb 100644 --- a/src/Authoring/cswinmd/CsWinMD.csproj +++ b/src/Authoring/cswinmd/CsWinMD.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 Major preview enable diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7900d38c8..30bbea813 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -26,15 +26,15 @@ true false true - netcoreapp3.1;net6.0 - netcoreapp3.1;net6.0;net8.0 - netstandard2.0;net6.0;net8.0 - netstandard2.0;net6.0;net8.0 - net6.0;net8.0 - net6.0;net8.0 - net6.0-windows10.0.19041.0;net8.0-windows10.0.19041.0 - net6.0-windows10.0.19041.0 - net6.0;net8.0 + netcoreapp3.1;net8.0 + netcoreapp3.1;net8.0 + netstandard2.0;net8.0 + netstandard2.0;net8.0 + net8.0 + net8.0 + net8.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 + net8.0 false @@ -43,7 +43,7 @@ - $(MSBuildThisFileDirectory)Perf\IIDOptimizer\bin\$(Configuration)\net6.0\ + $(MSBuildThisFileDirectory)Perf\IIDOptimizer\bin\$(Configuration)\net8.0\ diff --git a/src/Perf/IIDOptimizer/IIDOptimizer.csproj b/src/Perf/IIDOptimizer/IIDOptimizer.csproj index 5872dcbdd..fc0fd2f80 100644 --- a/src/Perf/IIDOptimizer/IIDOptimizer.csproj +++ b/src/Perf/IIDOptimizer/IIDOptimizer.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable Major diff --git a/src/Perf/ResultsComparer/ResultsComparer.csproj b/src/Perf/ResultsComparer/ResultsComparer.csproj index 7d660ad56..6437c29e4 100644 --- a/src/Perf/ResultsComparer/ResultsComparer.csproj +++ b/src/Perf/ResultsComparer/ResultsComparer.csproj @@ -2,7 +2,7 @@ Exe $(PERFLAB_TARGET_FRAMEWORKS) - net6.0 + net8.0 latest diff --git a/src/Samples/AuthoringDemo/AuthoringDemo/AuthoringDemo.csproj b/src/Samples/AuthoringDemo/AuthoringDemo/AuthoringDemo.csproj index ed2c818c0..b4b0e7eb9 100644 --- a/src/Samples/AuthoringDemo/AuthoringDemo/AuthoringDemo.csproj +++ b/src/Samples/AuthoringDemo/AuthoringDemo/AuthoringDemo.csproj @@ -1,7 +1,7 @@  - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 10.0.17763.0 x64;x86;arm64 diff --git a/src/Samples/BgTaskComponent/BgTaskComponent/BgTaskComponent.csproj b/src/Samples/BgTaskComponent/BgTaskComponent/BgTaskComponent.csproj index bc1e09e48..cec92f499 100644 --- a/src/Samples/BgTaskComponent/BgTaskComponent/BgTaskComponent.csproj +++ b/src/Samples/BgTaskComponent/BgTaskComponent/BgTaskComponent.csproj @@ -1,7 +1,7 @@  - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 x64;x86 win10-x86;win10-x64 diff --git a/src/Samples/BgTaskComponent/BgTaskComponent/WinRT.Host.runtimeconfig.json b/src/Samples/BgTaskComponent/BgTaskComponent/WinRT.Host.runtimeconfig.json index 2f2c17443..cd3f3d5ba 100644 --- a/src/Samples/BgTaskComponent/BgTaskComponent/WinRT.Host.runtimeconfig.json +++ b/src/Samples/BgTaskComponent/BgTaskComponent/WinRT.Host.runtimeconfig.json @@ -1,10 +1,10 @@ { "runtimeOptions": { - "tfm": "net6.0", + "tfm": "net8.0", "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", - "version": "6.0.0" + "version": "8.0.0" } } } diff --git a/src/Samples/BgTaskComponent/WpfApp/WpfApp.csproj b/src/Samples/BgTaskComponent/WpfApp/WpfApp.csproj index cfa8cdb19..23fa1cdf1 100644 --- a/src/Samples/BgTaskComponent/WpfApp/WpfApp.csproj +++ b/src/Samples/BgTaskComponent/WpfApp/WpfApp.csproj @@ -2,10 +2,10 @@ WinExe - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 true x64;x86 - win10-x64;win10-x86 + win-x64;win-x86 diff --git a/src/Samples/NetProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj b/src/Samples/NetProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj index 7db76183f..a36d80ce3 100644 --- a/src/Samples/NetProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj +++ b/src/Samples/NetProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj @@ -2,7 +2,7 @@ Exe - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 10.0.17763.0 x64;x86;ARM64 diff --git a/src/Samples/NetProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj b/src/Samples/NetProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj index ab9be6053..a5001fc64 100644 --- a/src/Samples/NetProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj +++ b/src/Samples/NetProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj @@ -1,7 +1,7 @@  - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 10.0.17763.0 AnyCPU diff --git a/src/Samples/NetProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec b/src/Samples/NetProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec index 58c1d02e6..33c2a9962 100644 --- a/src/Samples/NetProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec +++ b/src/Samples/NetProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec @@ -6,17 +6,16 @@ Contoso Math Inc. A simple component with basic math operations - - + - + - + - - + + \ No newline at end of file diff --git a/src/Samples/TestEmbedded/Net6App.Bootstrap/Net6App.Bootstrap.csproj b/src/Samples/TestEmbedded/Net6App.Bootstrap/Net6App.Bootstrap.csproj index c6b0f2ae2..10c3e89bc 100644 --- a/src/Samples/TestEmbedded/Net6App.Bootstrap/Net6App.Bootstrap.csproj +++ b/src/Samples/TestEmbedded/Net6App.Bootstrap/Net6App.Bootstrap.csproj @@ -1,7 +1,7 @@  Exe - net6.0-windows + net8.0-windows x64;x86 diff --git a/src/Samples/TestEmbedded/Net6App.Bootstrap/Program.cs b/src/Samples/TestEmbedded/Net6App.Bootstrap/Program.cs index 32270828c..3c0bd8abe 100644 --- a/src/Samples/TestEmbedded/Net6App.Bootstrap/Program.cs +++ b/src/Samples/TestEmbedded/Net6App.Bootstrap/Program.cs @@ -4,7 +4,7 @@ using Gamma; using Windows.Media; -namespace Net6App.Bootstrap +namespace Net8App.Bootstrap { class Program { diff --git a/src/Samples/TestEmbedded/Net6App/Net6App.csproj b/src/Samples/TestEmbedded/Net6App/Net6App.csproj index 84dd2dd76..bf1387bde 100644 --- a/src/Samples/TestEmbedded/Net6App/Net6App.csproj +++ b/src/Samples/TestEmbedded/Net6App/Net6App.csproj @@ -2,7 +2,7 @@ Exe x64;x86 - net6.0-windows + net8.0-windows true sdk diff --git a/src/Samples/TestEmbedded/Net6App/Properties/launchSettings.json b/src/Samples/TestEmbedded/Net6App/Properties/launchSettings.json index f04e81d21..ada322420 100644 --- a/src/Samples/TestEmbedded/Net6App/Properties/launchSettings.json +++ b/src/Samples/TestEmbedded/Net6App/Properties/launchSettings.json @@ -1,6 +1,6 @@ { "profiles": { - "Net6App": { + "Net8App": { "commandName": "Project", "nativeDebugging": true } diff --git a/src/Samples/TestEmbedded/README.md b/src/Samples/TestEmbedded/README.md index 1fc9857d3..043dd52ea 100644 --- a/src/Samples/TestEmbedded/README.md +++ b/src/Samples/TestEmbedded/README.md @@ -9,8 +9,8 @@ This sample is composed of a few projects to demonstrate C#/WinRT embedded suppo - C++/WinRT component projects: *Alpha*, *Beta*, *Gamma* - *TestEmbeddedLibrary*: a C# library project using C#/WinRT embedded support to embed the WinRT.Runtime and Windows SDK sources into the projection/library output. - C#/.NET apps of various flavors that use the embedded projection (either by referencing *TestEmbeddedLibrary*, or by referencing the C++/WinRT components and generating the projection directly in the app project): - - *Net6App*: References *TestEmbeddedLibrary* to consume the embedded projection. - - *Net6App.Bootstrap*: References *Alpha*, *Beta*, and *Gamma* and creates an embeddded projection in the app itself. + - *Net8App*: References *TestEmbeddedLibrary* to consume the embedded projection. + - *Net8App.Bootstrap*: References *Alpha*, *Beta*, and *Gamma* and creates an embeddded projection in the app itself. - *NetCore3App*: References *TestEmbeddedLibrary* to consume the embedded projection. - *NetFrameworkApp*: References *Alpha*, *Beta*, and *Gamma* and creates an embeddded projection in the app itself. @@ -18,11 +18,11 @@ Looking at the C#/WinRT embedded projection, `TestEmbeddedLibrary`, we see it ta demonstrating support for the latest Windows SDK on all platforms. ```xml - net6.0-windows;netstandard2.0;net48 + net8.0-windows;netstandard2.0;net48 ``` -Of the apps, `Net6App` and `NetCore3App` reference the same C#/WinRT embedded projection (*TestEmbeddedLibrary*) to make use of WinRT APIs -like `Windows.Devices.Geolocation`. The other two apps, `Net6App.Bootstrap` and `NetFrameworkApp`, demonstrate how an app can generate and embed the projection itself using a package reference to C#/WinRT. +Of the apps, `Net8App` and `NetCore3App` reference the same C#/WinRT embedded projection (*TestEmbeddedLibrary*) to make use of WinRT APIs +like `Windows.Devices.Geolocation`. The other two apps, `Net8App.Bootstrap` and `NetFrameworkApp`, demonstrate how an app can generate and embed the projection itself using a package reference to C#/WinRT. ## Build and run the sample diff --git a/src/Samples/TestEmbedded/TestEmbedded.sln b/src/Samples/TestEmbedded/TestEmbedded.sln index 429d7c34d..c89438839 100644 --- a/src/Samples/TestEmbedded/TestEmbedded.sln +++ b/src/Samples/TestEmbedded/TestEmbedded.sln @@ -24,7 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net6App", "Net6App\Net6App.csproj", "{1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net8App", "Net8App\Net8App.csproj", "{1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCore3App", "NetCore3App\NetCore3App.csproj", "{9B147973-329B-4331-8207-B6832696D01A}" EndProject @@ -32,7 +32,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTestEmbedded", "UnitTes EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetFrameworkApp", "NetFrameworkApp\NetFrameworkApp.csproj", "{6A457D15-4080-4CCA-9980-D418C2EE2BDF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net6App.Bootstrap", "Net6App.Bootstrap\Net6App.Bootstrap.csproj", "{D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net8App.Bootstrap", "Net8App.Bootstrap\Net8App.Bootstrap.csproj", "{D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestEmbeddedLibrary.csproj b/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestEmbeddedLibrary.csproj index f62b2a1a8..eb14137eb 100644 --- a/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestEmbeddedLibrary.csproj +++ b/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestEmbeddedLibrary.csproj @@ -1,7 +1,7 @@  - net6.0-windows;netstandard2.0;net48 + net8.0-windows;netstandard2.0;net48 x64;x86 diff --git a/src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj b/src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj index bf4d1ae85..41ec4fe3e 100644 --- a/src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj +++ b/src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net6.0 + netcoreapp3.1;net8.0 x64;x86 false true diff --git a/src/Samples/TestEmbedded/clean.cmd b/src/Samples/TestEmbedded/clean.cmd index 5df6934b3..94b5d64c4 100644 --- a/src/Samples/TestEmbedded/clean.cmd +++ b/src/Samples/TestEmbedded/clean.cmd @@ -14,8 +14,8 @@ rd /q/s "%this_dir%\C++ Components\Gamma\Generated Files" rd /q/s "%this_dir%\C++ Components\Gamma\x64" rd /q/s "%this_dir%\C++ Components\Gamma\x86" -rd /q/s "%this_dir%\Net6App\bin" -rd /q/s "%this_dir%\Net6App\obj" +rd /q/s "%this_dir%\Net8App\bin" +rd /q/s "%this_dir%\Net8App\obj" rd /q/s "%this_dir%\NetCore3App\bin" rd /q/s "%this_dir%\NetCore3App\obj" diff --git a/src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj b/src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj index ed63680bb..46b9767bf 100644 --- a/src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj +++ b/src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj @@ -2,7 +2,7 @@ WinExe - net6.0-windows10.0.19041.0 + net8.0-windows10.0.19041.0 DISABLE_XAML_GENERATED_MAIN WinUIDesktopSample.exe.manifest diff --git a/src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json b/src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json index 04a2d0f23..0a58e1da8 100644 --- a/src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json +++ b/src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json @@ -1,6 +1,6 @@ { "runtimeOptions": { - "tfm": "net6.0", + "tfm": "net8.0", "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", diff --git a/src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json b/src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json index 73a4f7d48..fec27f4ed 100644 --- a/src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json +++ b/src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json @@ -1,6 +1,6 @@ { "runtimeOptions": { - "tfm": "net6.0", + "tfm": "net8.0", "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", diff --git a/src/Tests/HostTest/HostTest.vcxproj b/src/Tests/HostTest/HostTest.vcxproj index dfd15efad..7eaa675ae 100644 --- a/src/Tests/HostTest/HostTest.vcxproj +++ b/src/Tests/HostTest/HostTest.vcxproj @@ -60,26 +60,26 @@ {ef3326b5-716f-41d2-ab30-4efab30955e2} - TargetFramework=net6.0 + TargetFramework=net8.0 {c6d580c5-7037-4733-b933-916ff400afe2} - TargetFramework=net6.0 + TargetFramework=net8.0 {ffa9a78b-f53f-43ee-af87-24a80f4c330a} - TargetFramework=net6.0 + TargetFramework=net8.0 {0bb8f82d-874e-45aa-bca3-20ce0562164a} - TargetFramework=net6.0 + TargetFramework=net8.0 {7e33bcb7-19c5-4061-981d-ba695322708a} {25244ced-966e-45f2-9711-1f51e951ff89} - TargetFramework=net6.0 + TargetFramework=net8.0 diff --git a/src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json b/src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json index 79347bff9..f13846f94 100644 --- a/src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json +++ b/src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json @@ -1,6 +1,6 @@ { "runtimeOptions": { - "tfm": "net6.0", + "tfm": "net8.0", "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", diff --git a/src/Tests/HostTest/RuntimeFrameworkVersion.csproj b/src/Tests/HostTest/RuntimeFrameworkVersion.csproj index 75f69eb7d..b52d5199b 100644 --- a/src/Tests/HostTest/RuntimeFrameworkVersion.csproj +++ b/src/Tests/HostTest/RuntimeFrameworkVersion.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/HostTest/Test.Host.runtimeconfig.json b/src/Tests/HostTest/Test.Host.runtimeconfig.json index 14f127d48..be5d9aa3e 100644 --- a/src/Tests/HostTest/Test.Host.runtimeconfig.json +++ b/src/Tests/HostTest/Test.Host.runtimeconfig.json @@ -1,10 +1,10 @@ { "runtimeOptions": { - "tfm": "net6.0", + "tfm": "net8.0", "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", - "version": "6.0.0-preview" + "version": "8.0.0" } } } \ No newline at end of file diff --git a/src/Tests/HostTest/WinRT.Host.runtimeconfig.json b/src/Tests/HostTest/WinRT.Host.runtimeconfig.json index 14f127d48..be5d9aa3e 100644 --- a/src/Tests/HostTest/WinRT.Host.runtimeconfig.json +++ b/src/Tests/HostTest/WinRT.Host.runtimeconfig.json @@ -1,10 +1,10 @@ { "runtimeOptions": { - "tfm": "net6.0", + "tfm": "net8.0", "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", - "version": "6.0.0-preview" + "version": "8.0.0" } } } \ No newline at end of file diff --git a/src/WinRT.Runtime/EventRegistrationTokenTable{T}.cs b/src/WinRT.Runtime/EventRegistrationTokenTable{T}.cs index 690c4c4e5..129797f94 100644 --- a/src/WinRT.Runtime/EventRegistrationTokenTable{T}.cs +++ b/src/WinRT.Runtime/EventRegistrationTokenTable{T}.cs @@ -54,7 +54,7 @@ private static int GetTypeOfTHashCode() // is expected to eventually wrap around, and we don't want to lose the // additional possible range of negative values (there's no reason for that). private int m_low32Bits = -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER Random.Shared.Next(int.MinValue, int.MaxValue); #else new Random().Next(int.MinValue, int.MaxValue); @@ -109,7 +109,7 @@ public EventRegistrationToken AddEventHandler(T handler) // where we'll use a different token value). int tokenLow32Bits; -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER do { // When on .NET 6+, just iterate on TryAdd, which allows skipping the extra @@ -147,7 +147,7 @@ public EventRegistrationToken AddEventHandler(T handler) /// Whether or not a registered event handler could be retrieved and removed from the table. public bool RemoveEventHandler( EventRegistrationToken token, -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER [NotNullWhen(true)] #endif out T? handler) @@ -169,7 +169,7 @@ public bool RemoveEventHandler( lock (m_tokens) { -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER // On .NET 6 and above, we can use a single lookup to both check whether the token // exists in the table, remove it, and also retrieve the removed handler to return. if (m_tokens.Remove((int)token.Value, out object? obj)) @@ -195,7 +195,7 @@ public bool RemoveEventHandler( return false; } } -} - -// Restore in case this file is merged with others. +} + +// Restore in case this file is merged with others. #nullable restore \ No newline at end of file diff --git a/src/WinRT.Runtime/Platform.cs b/src/WinRT.Runtime/Platform.cs index 8b54e7b08..ffd8f5c3d 100644 --- a/src/WinRT.Runtime/Platform.cs +++ b/src/WinRT.Runtime/Platform.cs @@ -55,7 +55,7 @@ partial class Platform { public static bool FreeLibrary(IntPtr moduleHandle) { -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER return LibraryImportStubs.FreeLibrary(moduleHandle); #else return FreeLibrary(moduleHandle); @@ -70,7 +70,7 @@ public static unsafe IntPtr TryGetProcAddress(IntPtr moduleHandle, ReadOnlySpan< { fixed (byte* lpFunctionName = functionName) { -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER return LibraryImportStubs.GetProcAddress(moduleHandle, (sbyte*)lpFunctionName); #else return GetProcAddress(moduleHandle, (sbyte*)lpFunctionName); @@ -97,7 +97,7 @@ public static unsafe IntPtr LoadLibraryExW(string fileName, IntPtr fileHandle, u { fixed (char* lpFileName = fileName) { -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER return LibraryImportStubs.LoadLibraryExW((ushort*)lpFileName, fileHandle, flags); #else return LoadLibraryExW((ushort*)lpFileName, fileHandle, flags); @@ -109,7 +109,7 @@ public static unsafe IntPtr LoadLibraryExW(string fileName, IntPtr fileHandle, u } } -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER // Marshalling stubs from [LibraryImport], which are used to get the same semantics (eg. for setting // the last P/Invoke errors, etc.) on .NET 6 as well ([LibraryImport] was only introduced in .NET 7). internal static class LibraryImportStubs diff --git a/src/WinRT.Runtime/WinRT.Runtime.csproj b/src/WinRT.Runtime/WinRT.Runtime.csproj index e95f467da..fd9779e5b 100644 --- a/src/WinRT.Runtime/WinRT.Runtime.csproj +++ b/src/WinRT.Runtime/WinRT.Runtime.csproj @@ -28,22 +28,18 @@ github - - + + $(AssemblyVersionNumber) - - 2.1.0.0 - - true - + @@ -91,7 +87,7 @@ $(MatchingRefApiCompatArgs) --allow-default-interface-methods - + @@ -101,7 +97,7 @@ - + <_ReferencePathDirectories Include="@(ReferencePath -> '%(RootDir)%(Directory)')" /> diff --git a/src/benchmark.cmd b/src/benchmark.cmd index 2a40cd0de..49991002f 100644 --- a/src/benchmark.cmd +++ b/src/benchmark.cmd @@ -5,9 +5,9 @@ set path=%DOTNET_ROOT%;%DOTNET_ROOT(x86)%;%path% nuget restore TestWinRT\Test.sln nuget restore cswinrt.sln msbuild Benchmarks\Benchmarks.csproj -t:restore -t:build /p:platform=x64 /p:configuration=release /p:solutiondir=%~dp0 /p:IsDotnetBuild=false -dotnet %~dp0Benchmarks\bin\x64\Release\net6.0\Benchmarks.dll -filter * --runtimes net6.0 +dotnet %~dp0Benchmarks\bin\x64\Release\net8.0\Benchmarks.dll -filter * --runtimes net8.0 nuget restore Perf\ResultsComparer\ResultsComparer.sln msbuild Perf\ResultsComparer\ResultsComparer.sln -t:restore -t:build /p:platform="Any CPU" /p:configuration=release set baselinedir=%1 IF "%baselinedir%" == "" set baselinedir="Perf\BenchmarkBaseline" -Perf\ResultsComparer\bin\Release\net6.0\ResultsComparer.exe --base %baselinedir% --diff BenchmarkDotNet.Artifacts\results\ --threshold 5%% --xml BenchmarkDotNet.Artifacts\results\comparison.xml \ No newline at end of file +Perf\ResultsComparer\bin\Release\net8.0\ResultsComparer.exe --base %baselinedir% --diff BenchmarkDotNet.Artifacts\results\ --threshold 5%% --xml BenchmarkDotNet.Artifacts\results\comparison.xml \ No newline at end of file diff --git a/src/build.cmd b/src/build.cmd index e3f9605fa..bf438fbef 100644 --- a/src/build.cmd +++ b/src/build.cmd @@ -184,7 +184,7 @@ if "%run_functional_tests%" EQU "true" ( for %%a in (%cswinrt_functional_tests%) do ( echo Publishing %%a - call :exec %msbuild_path%msbuild.exe /t:publish %cswinrt_build_params% /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;RuntimeIdentifier=win-%cswinrt_platform%;VersionNumber=%cswinrt_version_number%;VersionString=%cswinrt_version_string%;AssemblyVersionNumber=%cswinrt_assembly_version%;GenerateTestProjection=true;BaselineAllAPICompatError=%cswinrt_baseline_breaking_compat_errors%;BaselineAllMatchingRefApiCompatError=%cswinrt_baseline_assembly_version_compat_errors% /p:TargetFramework=net6.0 /p:solutiondir=%this_dir% %this_dir%Tests\FunctionalTests\%%a\%%a.csproj -bl:CCWBin%%a.binlog + call :exec %msbuild_path%msbuild.exe /t:publish %cswinrt_build_params% /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;RuntimeIdentifier=win-%cswinrt_platform%;VersionNumber=%cswinrt_version_number%;VersionString=%cswinrt_version_string%;AssemblyVersionNumber=%cswinrt_assembly_version%;GenerateTestProjection=true;BaselineAllAPICompatError=%cswinrt_baseline_breaking_compat_errors%;BaselineAllMatchingRefApiCompatError=%cswinrt_baseline_assembly_version_compat_errors% /p:TargetFramework=net8.0 /p:solutiondir=%this_dir% %this_dir%Tests\FunctionalTests\%%a\%%a.csproj -bl:CCWBin%%a.binlog ) ) @@ -293,7 +293,7 @@ if "%run_functional_tests%" EQU "true" ( for %%a in (%cswinrt_functional_tests%) do ( echo Running %%a - call :exec %this_dir%Tests\FunctionalTests\%%a\bin\%cswinrt_configuration%\net6.0\win-%cswinrt_platform%\publish\%%a.exe + call :exec %this_dir%Tests\FunctionalTests\%%a\bin\%cswinrt_configuration%\net8.0\win-%cswinrt_platform%\publish\%%a.exe if !errorlevel! NEQ 100 ( echo. echo ERROR: Functional test '%%a' failed with !errorlevel!, skipping NuGet pack @@ -328,17 +328,16 @@ set cswinrt_bin_dir=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\ set cswinrt_exe=%cswinrt_bin_dir%cswinrt.exe set interop_winmd=%cswinrt_bin_dir%WinRT.Interop.winmd set netstandard2_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\netstandard2.0\WinRT.Runtime.dll -set net6_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\net6.0\WinRT.Runtime.dll set net8_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\net8.0\WinRT.Runtime.dll set source_generator=%this_dir%Authoring\WinRT.SourceGenerator\bin\%cswinrt_configuration%\netstandard2.0\WinRT.SourceGenerator.dll set winrt_host_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll set winrt_host_resource_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll.mui -set winrt_shim=%this_dir%Authoring\WinRT.Host.Shim\bin\%cswinrt_configuration%\net6.0\WinRT.Host.Shim.dll -set guid_patch=%this_dir%Perf\IIDOptimizer\bin\%cswinrt_configuration%\net6.0\*.* -set cswinmd_outpath=%this_dir%Authoring\cswinmd\bin\%cswinrt_configuration%\net6.0 +set winrt_shim=%this_dir%Authoring\WinRT.Host.Shim\bin\%cswinrt_configuration%\net8.0\WinRT.Host.Shim.dll +set guid_patch=%this_dir%Perf\IIDOptimizer\bin\%cswinrt_configuration%\net8.0\*.* +set cswinmd_outpath=%this_dir%Authoring\cswinmd\bin\%cswinrt_configuration%\net8.0 rem Now call pack echo Creating nuget package -call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;netstandard2_runtime=%netstandard2_runtime%;net6_runtime=%net6_runtime%;net8_runtime=%net8_runtime%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_host_resource_x86=%winrt_host_resource_x86%;winrt_host_resource_x64=%winrt_host_resource_x64%;winrt_host_resource_arm=%winrt_host_resource_arm%;winrt_host_resource_arm64=%winrt_host_resource_arm64%;winrt_shim=%winrt_shim%;guid_patch=%guid_patch% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis +call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;netstandard2_runtime=%netstandard2_runtime%;net8_runtime=%net8_runtime%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_host_resource_x86=%winrt_host_resource_x86%;winrt_host_resource_x64=%winrt_host_resource_x64%;winrt_host_resource_arm=%winrt_host_resource_arm%;winrt_host_resource_arm64=%winrt_host_resource_arm64%;winrt_shim=%winrt_shim%;guid_patch=%guid_patch% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinMD.nuspec -Properties cswinmd_outpath=%cswinmd_outpath%;source_generator=%source_generator%;cswinmd_nuget_version=%cswinrt_version_string%; -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis goto :eof diff --git a/src/cswinrt/main.cpp b/src/cswinrt/main.cpp index 942d5bbf7..6a52eccf2 100644 --- a/src/cswinrt/main.cpp +++ b/src/cswinrt/main.cpp @@ -34,7 +34,7 @@ namespace cswinrt { "include", 0, option::no_max, "", "One or more prefixes to include in projection" }, { "exclude", 0, option::no_max, "", "One or more prefixes to exclude from projection" }, { "addition_exclude", 0, option::no_max, "", "One or more namespace prefixes to exclude from the projection additions" }, - { "target", 0, 1, "", "Target TFM for projection. Omit for compatibility with .NET 6." }, + { "target", 0, 1, "", "Target TFM for projection. Omit for compatibility with .NET 8." }, { "component", 0, 0, {}, "Generate component projection." }, { "verbose", 0, 0, {}, "Show detailed progress information" }, { "internal", 0, 0, {}, "Generates a private projection."}, @@ -98,6 +98,11 @@ Where is one or more of: { throw usage_exception(); } + else if (target.empty()) + { + // Default to .NET 8 if no explicit target is set + target = "net8.0"; + } settings.netstandard_compat = target == "netstandard2.0"; settings.net7_0_or_greater = starts_with(target, "net7.0") || starts_with(target, "net8.0"); settings.component = args.exists("component"); From c811054b29cdf43db1abf0fbe7103e550999f39d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 22 Nov 2024 14:23:13 -0800 Subject: [PATCH 02/14] Update RIDs for .NET 8 --- .../CsWinRT-BuildAndTest-Stage.yml | 2 +- .../BgTaskComponent/BgTaskComponent.csproj | 2 +- src/Tests/FunctionalTests/Async/Async.csproj | 2 +- src/Tests/FunctionalTests/CCW/CCW.csproj | 2 +- .../ClassActivation/ClassActivation.csproj | 2 +- .../Collections/Collections.csproj | 2 +- .../DerivedClassActivation.csproj | 2 +- .../DerivedClassAsBaseClass.csproj | 2 +- .../DynamicInterfaceCasting.csproj | 2 +- .../FunctionalTests/Events/Events.csproj | 2 +- .../JsonValueFunctionCalls.csproj | 2 +- .../FunctionalTests/NonWinRT/NonWinRT.csproj | 2 +- .../OptInMode/OptInMode.csproj | 2 +- .../{win10-arm64.pubxml => win-arm64.pubxml} | 28 +++++++++---------- .../{win10-x64.pubxml => win-x64.pubxml} | 28 +++++++++---------- .../{win10-x86.pubxml => win-x86.pubxml} | 28 +++++++++---------- .../FunctionalTests/Structs/Structs.csproj | 2 +- .../ObjectLifetimeTests.Lifted.csproj | 4 +-- .../{win10-arm64.pubxml => win-arm64.pubxml} | 2 +- .../{win10-x64.pubxml => win-x64.pubxml} | 2 +- .../{win10-x86.pubxml => win-x86.pubxml} | 2 +- src/build.cmd | 2 +- src/cswinrt.sln | 6 ++-- 23 files changed, 65 insertions(+), 65 deletions(-) rename src/Tests/FunctionalTests/PublishProfiles/{win10-arm64.pubxml => win-arm64.pubxml} (98%) rename src/Tests/FunctionalTests/PublishProfiles/{win10-x64.pubxml => win-x64.pubxml} (98%) rename src/Tests/FunctionalTests/PublishProfiles/{win10-x86.pubxml => win-x86.pubxml} (98%) rename src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/{win10-arm64.pubxml => win-arm64.pubxml} (92%) rename src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/{win10-x64.pubxml => win-x64.pubxml} (92%) rename src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/{win10-x86.pubxml => win-x86.pubxml} (92%) diff --git a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml index eaac307db..244bcd3dd 100644 --- a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml +++ b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml @@ -77,7 +77,7 @@ stages: displayName: Run Object Lifetime Tests condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildPlatform'], 'x64'))) inputs: - testAssemblyVer2: Tests\ObjectLifetimeTests\bin\$(BuildPlatform)\$(BuildConfiguration)\net8.0-windows10.0.19041.0\win10-$(BuildPlatform)\ObjectLifetimeTests.Lifted.build.appxrecipe + testAssemblyVer2: Tests\ObjectLifetimeTests\bin\$(BuildPlatform)\$(BuildConfiguration)\net8.0-windows10.0.19041.0\win-$(BuildPlatform)\ObjectLifetimeTests.Lifted.build.appxrecipe searchFolder: $(Build.SourcesDirectory)\src # Run Host Tests diff --git a/src/Samples/BgTaskComponent/BgTaskComponent/BgTaskComponent.csproj b/src/Samples/BgTaskComponent/BgTaskComponent/BgTaskComponent.csproj index cec92f499..ce7a2c679 100644 --- a/src/Samples/BgTaskComponent/BgTaskComponent/BgTaskComponent.csproj +++ b/src/Samples/BgTaskComponent/BgTaskComponent/BgTaskComponent.csproj @@ -3,7 +3,7 @@ net8.0-windows10.0.19041.0 x64;x86 - win10-x86;win10-x64 + win-x86;win-x64 diff --git a/src/Tests/FunctionalTests/Async/Async.csproj b/src/Tests/FunctionalTests/Async/Async.csproj index 33d0482d3..420191949 100644 --- a/src/Tests/FunctionalTests/Async/Async.csproj +++ b/src/Tests/FunctionalTests/Async/Async.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml diff --git a/src/Tests/FunctionalTests/CCW/CCW.csproj b/src/Tests/FunctionalTests/CCW/CCW.csproj index c5e8cd234..c7fe45f74 100644 --- a/src/Tests/FunctionalTests/CCW/CCW.csproj +++ b/src/Tests/FunctionalTests/CCW/CCW.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml true diff --git a/src/Tests/FunctionalTests/ClassActivation/ClassActivation.csproj b/src/Tests/FunctionalTests/ClassActivation/ClassActivation.csproj index 33d0482d3..420191949 100644 --- a/src/Tests/FunctionalTests/ClassActivation/ClassActivation.csproj +++ b/src/Tests/FunctionalTests/ClassActivation/ClassActivation.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml diff --git a/src/Tests/FunctionalTests/Collections/Collections.csproj b/src/Tests/FunctionalTests/Collections/Collections.csproj index 3559f5c97..98495ff99 100644 --- a/src/Tests/FunctionalTests/Collections/Collections.csproj +++ b/src/Tests/FunctionalTests/Collections/Collections.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml diff --git a/src/Tests/FunctionalTests/DerivedClassActivation/DerivedClassActivation.csproj b/src/Tests/FunctionalTests/DerivedClassActivation/DerivedClassActivation.csproj index 157b9992c..7f0423881 100644 --- a/src/Tests/FunctionalTests/DerivedClassActivation/DerivedClassActivation.csproj +++ b/src/Tests/FunctionalTests/DerivedClassActivation/DerivedClassActivation.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml diff --git a/src/Tests/FunctionalTests/DerivedClassAsBaseClass/DerivedClassAsBaseClass.csproj b/src/Tests/FunctionalTests/DerivedClassAsBaseClass/DerivedClassAsBaseClass.csproj index d84c05d8c..4200014b4 100644 --- a/src/Tests/FunctionalTests/DerivedClassAsBaseClass/DerivedClassAsBaseClass.csproj +++ b/src/Tests/FunctionalTests/DerivedClassAsBaseClass/DerivedClassAsBaseClass.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml diff --git a/src/Tests/FunctionalTests/DynamicInterfaceCasting/DynamicInterfaceCasting.csproj b/src/Tests/FunctionalTests/DynamicInterfaceCasting/DynamicInterfaceCasting.csproj index d19ce67c4..4db5916f4 100644 --- a/src/Tests/FunctionalTests/DynamicInterfaceCasting/DynamicInterfaceCasting.csproj +++ b/src/Tests/FunctionalTests/DynamicInterfaceCasting/DynamicInterfaceCasting.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml true diff --git a/src/Tests/FunctionalTests/Events/Events.csproj b/src/Tests/FunctionalTests/Events/Events.csproj index 33d0482d3..420191949 100644 --- a/src/Tests/FunctionalTests/Events/Events.csproj +++ b/src/Tests/FunctionalTests/Events/Events.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml diff --git a/src/Tests/FunctionalTests/JsonValueFunctionCalls/JsonValueFunctionCalls.csproj b/src/Tests/FunctionalTests/JsonValueFunctionCalls/JsonValueFunctionCalls.csproj index 157b9992c..7f0423881 100644 --- a/src/Tests/FunctionalTests/JsonValueFunctionCalls/JsonValueFunctionCalls.csproj +++ b/src/Tests/FunctionalTests/JsonValueFunctionCalls/JsonValueFunctionCalls.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml diff --git a/src/Tests/FunctionalTests/NonWinRT/NonWinRT.csproj b/src/Tests/FunctionalTests/NonWinRT/NonWinRT.csproj index 06d462ead..21513321e 100644 --- a/src/Tests/FunctionalTests/NonWinRT/NonWinRT.csproj +++ b/src/Tests/FunctionalTests/NonWinRT/NonWinRT.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml true TEST_UNSAFE_DISABLED false diff --git a/src/Tests/FunctionalTests/OptInMode/OptInMode.csproj b/src/Tests/FunctionalTests/OptInMode/OptInMode.csproj index 51bed49b8..69c29358a 100644 --- a/src/Tests/FunctionalTests/OptInMode/OptInMode.csproj +++ b/src/Tests/FunctionalTests/OptInMode/OptInMode.csproj @@ -5,7 +5,7 @@ net8.0 x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml OptIn diff --git a/src/Tests/FunctionalTests/PublishProfiles/win10-arm64.pubxml b/src/Tests/FunctionalTests/PublishProfiles/win-arm64.pubxml similarity index 98% rename from src/Tests/FunctionalTests/PublishProfiles/win10-arm64.pubxml rename to src/Tests/FunctionalTests/PublishProfiles/win-arm64.pubxml index 8f10dce5b..a590c9248 100644 --- a/src/Tests/FunctionalTests/PublishProfiles/win10-arm64.pubxml +++ b/src/Tests/FunctionalTests/PublishProfiles/win-arm64.pubxml @@ -1,14 +1,14 @@ - - - - FileSystem - arm64 - win-arm64 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - True - True - False - True - true - - + + + + FileSystem + arm64 + win-arm64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + True + True + False + True + true + + diff --git a/src/Tests/FunctionalTests/PublishProfiles/win10-x64.pubxml b/src/Tests/FunctionalTests/PublishProfiles/win-x64.pubxml similarity index 98% rename from src/Tests/FunctionalTests/PublishProfiles/win10-x64.pubxml rename to src/Tests/FunctionalTests/PublishProfiles/win-x64.pubxml index 8d38f63e6..3e4d923a6 100644 --- a/src/Tests/FunctionalTests/PublishProfiles/win10-x64.pubxml +++ b/src/Tests/FunctionalTests/PublishProfiles/win-x64.pubxml @@ -1,14 +1,14 @@ - - - - FileSystem - x64 - win-x64 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - True - True - False - True - true - - + + + + FileSystem + x64 + win-x64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + True + True + False + True + true + + diff --git a/src/Tests/FunctionalTests/PublishProfiles/win10-x86.pubxml b/src/Tests/FunctionalTests/PublishProfiles/win-x86.pubxml similarity index 98% rename from src/Tests/FunctionalTests/PublishProfiles/win10-x86.pubxml rename to src/Tests/FunctionalTests/PublishProfiles/win-x86.pubxml index 1a69d532b..7b68d9aa0 100644 --- a/src/Tests/FunctionalTests/PublishProfiles/win10-x86.pubxml +++ b/src/Tests/FunctionalTests/PublishProfiles/win-x86.pubxml @@ -1,14 +1,14 @@ - - - - FileSystem - x86 - win-x86 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - True - True - False - True - true - - + + + + FileSystem + x86 + win-x86 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + True + True + False + True + true + + diff --git a/src/Tests/FunctionalTests/Structs/Structs.csproj b/src/Tests/FunctionalTests/Structs/Structs.csproj index 157b9992c..7f0423881 100644 --- a/src/Tests/FunctionalTests/Structs/Structs.csproj +++ b/src/Tests/FunctionalTests/Structs/Structs.csproj @@ -5,7 +5,7 @@ $(FunctionalTestsBuildTFMs) x86;x64 win-x86;win-x64 - $(MSBuildProjectDirectory)\..\PublishProfiles\win10-$(Platform).pubxml + $(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml diff --git a/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj b/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj index 13a269ab4..568b1dd87 100644 --- a/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj +++ b/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj @@ -6,9 +6,9 @@ ObjectLifetimeTests.Lifted app.manifest x86;x64;arm64 - win10-x86;win10-x64;win10-arm64 + win-x86;win-x64;win-arm64 True - win10-$(Platform).pubxml + win-$(Platform).pubxml false false diff --git a/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-arm64.pubxml b/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-arm64.pubxml similarity index 92% rename from src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-arm64.pubxml rename to src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-arm64.pubxml index 5c3d986e4..7cb800162 100644 --- a/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-arm64.pubxml +++ b/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-arm64.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem arm64 - win10-arm64 + win-arm64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False diff --git a/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-x64.pubxml b/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-x64.pubxml similarity index 92% rename from src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-x64.pubxml rename to src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-x64.pubxml index 352786e6f..a144a836f 100644 --- a/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-x64.pubxml +++ b/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-x64.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem x64 - win10-x64 + win-x64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False diff --git a/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-x86.pubxml b/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-x86.pubxml similarity index 92% rename from src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-x86.pubxml rename to src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-x86.pubxml index 68ad82ae0..3d4af2dd6 100644 --- a/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win10-x86.pubxml +++ b/src/Tests/ObjectLifetimeTests/Properties/PublishProfiles/win-x86.pubxml @@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem x86 - win10-x86 + win-x86 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False diff --git a/src/build.cmd b/src/build.cmd index bf438fbef..4059b65ae 100644 --- a/src/build.cmd +++ b/src/build.cmd @@ -245,7 +245,7 @@ if ErrorLevel 1 ( rem Running Object Lifetime Unit Tests echo Running object lifetime tests for %cswinrt_platform% %cswinrt_configuration% if '%NUGET_PACKAGES%'=='' set NUGET_PACKAGES=%USERPROFILE%\.nuget\packages -call :exec vstest.console.exe %this_dir%\Tests\ObjectLifetimeTests\bin\%cswinrt_platform%\%cswinrt_configuration%\net8.0-windows10.0.19041.0\win10-%cswinrt_platform%\ObjectLifetimeTests.Lifted.build.appxrecipe /TestAdapterPath:"%NUGET_PACKAGES%\mstest.testadapter\2.2.4-preview-20210513-02\build\_common" /framework:FrameworkUap10 /logger:trx;LogFileName=%this_dir%\VsTestResults.trx +call :exec vstest.console.exe %this_dir%\Tests\ObjectLifetimeTests\bin\%cswinrt_platform%\%cswinrt_configuration%\net8.0-windows10.0.19041.0\win-%cswinrt_platform%\ObjectLifetimeTests.Lifted.build.appxrecipe /TestAdapterPath:"%NUGET_PACKAGES%\mstest.testadapter\2.2.4-preview-20210513-02\build\_common" /framework:FrameworkUap10 /logger:trx;LogFileName=%this_dir%\VsTestResults.trx if ErrorLevel 1 ( echo. echo ERROR: Lifetime test failed, skipping NuGet pack diff --git a/src/cswinrt.sln b/src/cswinrt.sln index 7a02cc529..f74d6d53b 100644 --- a/src/cswinrt.sln +++ b/src/cswinrt.sln @@ -133,9 +133,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FunctionalTests", "Function EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PublishProfiles", "PublishProfiles", "{6FBE79A9-9D6D-4436-9F84-797ED1C9F676}" ProjectSection(SolutionItems) = preProject - Tests\FunctionalTests\PublishProfiles\win10-arm64.pubxml = Tests\FunctionalTests\PublishProfiles\win10-arm64.pubxml - Tests\FunctionalTests\PublishProfiles\win10-x64.pubxml = Tests\FunctionalTests\PublishProfiles\win10-x64.pubxml - Tests\FunctionalTests\PublishProfiles\win10-x86.pubxml = Tests\FunctionalTests\PublishProfiles\win10-x86.pubxml + Tests\FunctionalTests\PublishProfiles\win-arm64.pubxml = Tests\FunctionalTests\PublishProfiles\win-arm64.pubxml + Tests\FunctionalTests\PublishProfiles\win-x64.pubxml = Tests\FunctionalTests\PublishProfiles\win-x64.pubxml + Tests\FunctionalTests\PublishProfiles\win-x86.pubxml = Tests\FunctionalTests\PublishProfiles\win-x86.pubxml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassActivation", "Tests\FunctionalTests\ClassActivation\ClassActivation.csproj", "{F0D6034B-5368-4B13-BBB9-4ABBC535AA0E}" From fd92985c3db94295bd75e8cd0b872ac453baf44d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 22 Nov 2024 14:54:34 -0800 Subject: [PATCH 03/14] Bump .NET SDK in build script --- CONTRIBUTING.md | 5 ++--- build/AzurePipelineTemplates/CsWinRT-Variables.yml | 2 +- src/build.cmd | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e7cc2173..4b55b2ae3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,9 +6,8 @@ Below is our guidance for how to build the repo, report issues, propose new feat C#/WinRT currently requires the following packages, or newer, to build: -- [Visual Studio 17.0](https://visualstudio.microsoft.com/downloads/) -- [.NET 6.0 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) -- [.NET Core 3.1 SDK](https://dotnet.microsoft.com/download/dotnet-core/3.1) +- [Visual Studio 17.0](https://visualstudio.microsoft.com/downloads/) +- [.NET 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) - [nuget.exe 5.8.0-preview.3](https://www.nuget.org/downloads) - Microsoft.WinUI 3.0.0-preview4.210210.4 - Microsoft.WindowsAppSDK 1.1.5 diff --git a/build/AzurePipelineTemplates/CsWinRT-Variables.yml b/build/AzurePipelineTemplates/CsWinRT-Variables.yml index 66232cf79..a660d2e07 100644 --- a/build/AzurePipelineTemplates/CsWinRT-Variables.yml +++ b/build/AzurePipelineTemplates/CsWinRT-Variables.yml @@ -25,7 +25,7 @@ variables: - name: _RunGCStress value: $[coalesce(variables.RunGCStress, 'false')] - name: _DotNetRuntimeVersion - value: $[coalesce(variables.DotNetRuntimeVersion, '6.0.32')] + value: $[coalesce(variables.DotNetRuntimeVersion, '8.0.303')] - name: _WindowsSdkVersionSuffix value: $[coalesce(variables.WindowsSdkPackageVersionSuffix, '25')] - name: _PublishCsWinMD diff --git a/src/build.cmd b/src/build.cmd index 4059b65ae..5249236e3 100644 --- a/src/build.cmd +++ b/src/build.cmd @@ -1,7 +1,7 @@ @echo off if /i "%cswinrt_echo%" == "on" @echo on -set CsWinRTBuildNetSDKVersion=6.0.424 +set CsWinRTBuildNetSDKVersion=8.0.303 set CsWinRTBuildNet8SDKVersion=8.0.303 set this_dir=%~dp0 From e49007c407c25e16b163f90f13c251fa946dc72f Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 22 Nov 2024 15:44:37 -0800 Subject: [PATCH 04/14] Override RIDs for 'WinUIDesktopSample' project --- src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj b/src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj index 46b9767bf..dfc6412a8 100644 --- a/src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj +++ b/src/Samples/WinUIDesktopSample/WinUIDesktopSample.csproj @@ -11,6 +11,7 @@ --> DoNotGenerateOtherProviders x86;x64 + win-x86;win-x64;win-arm64 true false true From e028e15955579f041f4726c8fea6c280b157b5c0 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 22 Nov 2024 16:15:44 -0800 Subject: [PATCH 05/14] Rename 'TestEmbedding' folders and files --- .../Net8App.Bootstrap.csproj} | 0 .../{Net6App.Bootstrap => Net8App.Bootstrap}/Program.cs | 0 .../{Net6App/Net6App.csproj => Net8App/Net8App.csproj} | 0 src/Samples/TestEmbedded/{Net6App => Net8App}/Program.cs | 0 .../{Net6App => Net8App}/Properties/launchSettings.json | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename src/Samples/TestEmbedded/{Net6App.Bootstrap/Net6App.Bootstrap.csproj => Net8App.Bootstrap/Net8App.Bootstrap.csproj} (100%) rename src/Samples/TestEmbedded/{Net6App.Bootstrap => Net8App.Bootstrap}/Program.cs (100%) rename src/Samples/TestEmbedded/{Net6App/Net6App.csproj => Net8App/Net8App.csproj} (100%) rename src/Samples/TestEmbedded/{Net6App => Net8App}/Program.cs (100%) rename src/Samples/TestEmbedded/{Net6App => Net8App}/Properties/launchSettings.json (100%) diff --git a/src/Samples/TestEmbedded/Net6App.Bootstrap/Net6App.Bootstrap.csproj b/src/Samples/TestEmbedded/Net8App.Bootstrap/Net8App.Bootstrap.csproj similarity index 100% rename from src/Samples/TestEmbedded/Net6App.Bootstrap/Net6App.Bootstrap.csproj rename to src/Samples/TestEmbedded/Net8App.Bootstrap/Net8App.Bootstrap.csproj diff --git a/src/Samples/TestEmbedded/Net6App.Bootstrap/Program.cs b/src/Samples/TestEmbedded/Net8App.Bootstrap/Program.cs similarity index 100% rename from src/Samples/TestEmbedded/Net6App.Bootstrap/Program.cs rename to src/Samples/TestEmbedded/Net8App.Bootstrap/Program.cs diff --git a/src/Samples/TestEmbedded/Net6App/Net6App.csproj b/src/Samples/TestEmbedded/Net8App/Net8App.csproj similarity index 100% rename from src/Samples/TestEmbedded/Net6App/Net6App.csproj rename to src/Samples/TestEmbedded/Net8App/Net8App.csproj diff --git a/src/Samples/TestEmbedded/Net6App/Program.cs b/src/Samples/TestEmbedded/Net8App/Program.cs similarity index 100% rename from src/Samples/TestEmbedded/Net6App/Program.cs rename to src/Samples/TestEmbedded/Net8App/Program.cs diff --git a/src/Samples/TestEmbedded/Net6App/Properties/launchSettings.json b/src/Samples/TestEmbedded/Net8App/Properties/launchSettings.json similarity index 100% rename from src/Samples/TestEmbedded/Net6App/Properties/launchSettings.json rename to src/Samples/TestEmbedded/Net8App/Properties/launchSettings.json From 88336a11534b60d05a84f113fcdf51a872ef6bae Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 23 Nov 2024 12:04:17 -0800 Subject: [PATCH 06/14] Update readme files --- src/Samples/AuthoringDemo/README.md | 2 +- src/Samples/BgTaskComponent/README.md | 2 +- src/Samples/NetProjectionSample/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Samples/AuthoringDemo/README.md b/src/Samples/AuthoringDemo/README.md index 7695f5860..f2d7e0645 100644 --- a/src/Samples/AuthoringDemo/README.md +++ b/src/Samples/AuthoringDemo/README.md @@ -14,7 +14,7 @@ The following apps demonstrate how to consume the C#/WinRT component **Authoring ## Prerequisites -* [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0) +* [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0) * Visual Studio 2022 **Note**: This sample can be modified to target .NET 5 and Visual Studio 2019. This involves editing the `TargetFramework` properties to target `net5.0-windows10.0.19041.0`. diff --git a/src/Samples/BgTaskComponent/README.md b/src/Samples/BgTaskComponent/README.md index da4a2a16e..dd45ab08c 100644 --- a/src/Samples/BgTaskComponent/README.md +++ b/src/Samples/BgTaskComponent/README.md @@ -14,7 +14,7 @@ This sample includes the following projects: ## Prerequisites -* [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0) +* [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0) * Visual Studio 2022 **Note**: This sample can be modified to target .NET 5 and Visual Studio 2019. This involves editing the `TargetFramework` properties to target `net5.0-windows10.0.19041.0`. diff --git a/src/Samples/NetProjectionSample/README.md b/src/Samples/NetProjectionSample/README.md index 9ecb94551..fa63be7c8 100644 --- a/src/Samples/NetProjectionSample/README.md +++ b/src/Samples/NetProjectionSample/README.md @@ -9,7 +9,7 @@ This sample demonstrates how to do the following: ## Requirements * [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) with the Universal Windows Platform development workload installed. In **Installation Details** > **Universal Windows Platform development**, check the **C++ (v14x) Universal Windows Platform tools** option. -* [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) +* [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) * nuget.exe 5.8.0-preview.2 or later (for command line MSBuild) **Note**: This sample uses .NET 6 and therefore requires Visual Studio 2022 to build and run. If you prefer, you can use Visual Studio 2019 and modify the sample to target [.NET 5](https://dotnet.microsoft.com/download/dotnet/5.0). To do this, you will need to modify the `TargetFramework` and the *nuspec* file in the `SimpleMathProjection` project to target `net5.0-windows10.0.19041.0`. From c4da096a87b9e76c13664b4c625586ebea230faa Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 23 Nov 2024 12:05:19 -0800 Subject: [PATCH 07/14] Update runtimeconfig.json files --- .../AuthoringWuxConsumptionTest/WinRT.Host.runtimeconfig.json | 2 +- src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json | 2 +- src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json | 2 +- src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tests/AuthoringWuxConsumptionTest/WinRT.Host.runtimeconfig.json b/src/Tests/AuthoringWuxConsumptionTest/WinRT.Host.runtimeconfig.json index 139d5dbc2..64a9c9082 100644 --- a/src/Tests/AuthoringWuxConsumptionTest/WinRT.Host.runtimeconfig.json +++ b/src/Tests/AuthoringWuxConsumptionTest/WinRT.Host.runtimeconfig.json @@ -4,7 +4,7 @@ "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", - "version": "6.0.0" + "version": "8.0.0" }, "configProperties": { "CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS": "true" diff --git a/src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json b/src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json index 0a58e1da8..904206592 100644 --- a/src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json +++ b/src/Tests/HostTest/BadMappedTarget.Host.runtimeconfig.json @@ -4,7 +4,7 @@ "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", - "version": "6.0.0-preview" + "version": "8.0.0" } }, "activatableClasses": { diff --git a/src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json b/src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json index fec27f4ed..12b04bbfe 100644 --- a/src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json +++ b/src/Tests/HostTest/ClassNotFound.Host.runtimeconfig.json @@ -4,7 +4,7 @@ "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", - "version": "6.0.0-preview" + "version": "8.0.0" } }, "activatableClasses": { diff --git a/src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json b/src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json index f13846f94..e2a488a15 100644 --- a/src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json +++ b/src/Tests/HostTest/MappedTarget.Host.runtimeconfig.json @@ -4,7 +4,7 @@ "rollForward": "LatestMinor", "framework": { "name": "Microsoft.NETCore.App", - "version": "6.0.0-preview" + "version": "8.0.0" } }, "activatableClasses": { From a4940e9e482d5b98ce455aaefd971e7a6825fc70 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 23 Nov 2024 12:08:48 -0800 Subject: [PATCH 08/14] Throw if < .NET 8 is used for projections --- src/cswinrt/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cswinrt/main.cpp b/src/cswinrt/main.cpp index 6a52eccf2..22d6cff98 100644 --- a/src/cswinrt/main.cpp +++ b/src/cswinrt/main.cpp @@ -34,7 +34,7 @@ namespace cswinrt { "include", 0, option::no_max, "", "One or more prefixes to include in projection" }, { "exclude", 0, option::no_max, "", "One or more prefixes to exclude from projection" }, { "addition_exclude", 0, option::no_max, "", "One or more namespace prefixes to exclude from the projection additions" }, - { "target", 0, 1, "", "Target TFM for projection. Omit for compatibility with .NET 8." }, + { "target", 0, 1, "", "Target TFM for projection (.NET 8 is the default)" }, { "component", 0, 0, {}, "Generate component projection." }, { "verbose", 0, 0, {}, "Show detailed progress information" }, { "internal", 0, 0, {}, "Generates a private projection."}, @@ -94,7 +94,7 @@ Where is one or more of: settings.verbose = args.exists("verbose"); auto target = args.value("target"); - if (!target.empty() && target != "netstandard2.0" && !starts_with(target, "net5.0") && !starts_with(target, "net6.0") && !starts_with(target, "net7.0") && !starts_with(target, "net8.0")) + if (!target.empty() && target != "netstandard2.0" && !starts_with(target, "net8.0")) { throw usage_exception(); } From 73ea2ad5d04ec2dff862c60d4fff7b6b5551b926 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 23 Nov 2024 12:10:43 -0800 Subject: [PATCH 09/14] Remove 'net7_0_or_greater' setting --- src/cswinrt/code_writers.h | 12 ++++++------ src/cswinrt/main.cpp | 1 - src/cswinrt/settings.h | 1 - 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/cswinrt/code_writers.h b/src/cswinrt/code_writers.h index 37d90807d..66de79821 100644 --- a/src/cswinrt/code_writers.h +++ b/src/cswinrt/code_writers.h @@ -10210,7 +10210,7 @@ switch (runtimeClassId) // just calling it. Otherwise, we switch on the string parameter, and generate a dummy ReadOnlySpan // overload just allocating and calling that. We always need both exports to make sure that hosting // scenarios also work, since those will be looking up the string overload via reflection. - settings.net7_0_or_greater ? "ReadOnlySpan" : "string", + settings.netstandard_compat ? "string" : "ReadOnlySpan", bind_each([](writer& w, TypeDef const& type) { w.write(R"( @@ -10224,15 +10224,15 @@ bind(type, typedef_name_type::CCW, true) }, types ), - settings.net7_0_or_greater ? R"( -public static IntPtr GetActivationFactory(string runtimeClassId) + settings.netstandard_compat ? R"( +public static IntPtr GetActivationFactory(ReadOnlySpan runtimeClassId) { - return GetActivationFactory(runtimeClassId.AsSpan()); + return GetActivationFactory(runtimeClassId.ToString()); } )" : R"( -public static IntPtr GetActivationFactory(ReadOnlySpan runtimeClassId) +public static IntPtr GetActivationFactory(string runtimeClassId) { - return GetActivationFactory(runtimeClassId.ToString()); + return GetActivationFactory(runtimeClassId.AsSpan()); } )"); } diff --git a/src/cswinrt/main.cpp b/src/cswinrt/main.cpp index 22d6cff98..afc76f7a5 100644 --- a/src/cswinrt/main.cpp +++ b/src/cswinrt/main.cpp @@ -104,7 +104,6 @@ Where is one or more of: target = "net8.0"; } settings.netstandard_compat = target == "netstandard2.0"; - settings.net7_0_or_greater = starts_with(target, "net7.0") || starts_with(target, "net8.0"); settings.component = args.exists("component"); settings.internal = args.exists("internal"); settings.embedded = args.exists("embedded"); diff --git a/src/cswinrt/settings.h b/src/cswinrt/settings.h index 5b944955a..4c7b9243a 100644 --- a/src/cswinrt/settings.h +++ b/src/cswinrt/settings.h @@ -13,7 +13,6 @@ namespace cswinrt winmd::reader::filter filter; winmd::reader::filter addition_filter; bool netstandard_compat{}; - bool net7_0_or_greater{}; bool component{}; bool internal{}; bool embedded{}; From 5af8521002929f39939d51c6010681517aacfbe9 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 23 Nov 2024 18:42:58 -0800 Subject: [PATCH 10/14] Fix leftover options Co-authored-by: Manodasan Wignarajah --- src/cswinrt/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cswinrt/main.cpp b/src/cswinrt/main.cpp index afc76f7a5..e7c65b848 100644 --- a/src/cswinrt/main.cpp +++ b/src/cswinrt/main.cpp @@ -34,7 +34,7 @@ namespace cswinrt { "include", 0, option::no_max, "", "One or more prefixes to include in projection" }, { "exclude", 0, option::no_max, "", "One or more prefixes to exclude from projection" }, { "addition_exclude", 0, option::no_max, "", "One or more namespace prefixes to exclude from the projection additions" }, - { "target", 0, 1, "", "Target TFM for projection (.NET 8 is the default)" }, + { "target", 0, 1, "", "Target TFM for projection (.NET 8 is the default)" }, { "component", 0, 0, {}, "Generate component projection." }, { "verbose", 0, 0, {}, "Show detailed progress information" }, { "internal", 0, 0, {}, "Generates a private projection."}, From 236cbb361f3a0ba151cce621e1ecc3540b5ba523 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 23 Nov 2024 19:27:55 -0800 Subject: [PATCH 11/14] Update RuntimeFrameworkVersion.csproj --- src/Tests/HostTest/RuntimeFrameworkVersion.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/HostTest/RuntimeFrameworkVersion.csproj b/src/Tests/HostTest/RuntimeFrameworkVersion.csproj index b52d5199b..5a4100cc5 100644 --- a/src/Tests/HostTest/RuntimeFrameworkVersion.csproj +++ b/src/Tests/HostTest/RuntimeFrameworkVersion.csproj @@ -8,7 +8,7 @@ From 9f70e47af80e6a36a4a3a4317993a59a1725e5ff Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Sun, 24 Nov 2024 01:53:10 -0800 Subject: [PATCH 12/14] Fix host tests --- src/Projections/Test/TestHost.ProbeByHost.cs | 100 ++---------------- .../TestHost.ProbeByClass.cs | 99 ++--------------- 2 files changed, 13 insertions(+), 186 deletions(-) diff --git a/src/Projections/Test/TestHost.ProbeByHost.cs b/src/Projections/Test/TestHost.ProbeByHost.cs index 8c6981d49..3dfb50aaa 100644 --- a/src/Projections/Test/TestHost.ProbeByHost.cs +++ b/src/Projections/Test/TestHost.ProbeByHost.cs @@ -7,108 +7,22 @@ using Windows.Foundation; using WinRT; - -#region Temporary, until authoring support generates activation factory support - -namespace Windows.Foundation -{ - [global::WinRT.WindowsRuntimeType] - [Guid("00000035-0000-0000-c000-000000000046")] - [WindowsRuntimeHelperType(typeof(global::ABI.Windows.Foundation.IActivationFactory))] - internal interface IActivationFactory - { - Object ActivateInstance(); - } -} - -namespace ABI.Windows.Foundation -{ -#if !NET - [global::WinRT.ObjectReferenceWrapper(nameof(_obj))] -#endif - [Guid("00000035-0000-0000-c000-000000000046")] - internal class IActivationFactory : global::Windows.Foundation.IActivationFactory - { - public unsafe delegate int ActivateInstance_0(IntPtr thisPtr, out IntPtr instance); - - [Guid("00000035-0000-0000-c000-000000000046")] - public struct Vftbl - { - internal IInspectable.Vftbl IInspectableVftbl; - public ActivateInstance_0 ActivateInstance_0; - - private static readonly Vftbl AbiToProjectionVftable; - public static readonly IntPtr AbiToProjectionVftablePtr; - static unsafe Vftbl() - { - AbiToProjectionVftable = new Vftbl - { - IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, - ActivateInstance_0 = Do_Abi_ActivateInstance_0 - }; - var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf() + sizeof(IntPtr) * 1); - Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); - AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; - } - - private static unsafe int Do_Abi_ActivateInstance_0(IntPtr thisPtr, out IntPtr instance) - { - object __instance = default; - instance = default; - try - { - __instance = global::WinRT.ComWrappersSupport.FindObject(thisPtr).ActivateInstance(); - instance = MarshalInspectable.FromManaged(__instance); - } - catch (Exception __exception__) - { - global::WinRT.ExceptionHelpers.SetErrorInfo(__exception__); - return global::WinRT.ExceptionHelpers.GetHRForException(__exception__); - } - return 0; - } - } - internal static ObjectReference FromAbi(IntPtr thisPtr) => ObjectReference.FromAbi(thisPtr, global::WinRT.Interop.IID.IID_IActivationFactory); - - protected readonly ObjectReference _obj; - public IObjectReference ObjRef { get => _obj; } - public IntPtr ThisPtr => _obj.ThisPtr; - public IActivationFactory(IObjectReference obj) : this(obj.As(global::WinRT.Interop.IID.IID_IActivationFactory)) { } - internal IActivationFactory(ObjectReference obj) - { - _obj = obj; - } - - public unsafe object ActivateInstance() - { - IntPtr __retval = default; - try - { - global::WinRT.ExceptionHelpers.ThrowExceptionForHR(_obj.Vftbl.ActivateInstance_0(ThisPtr, out __retval)); - return MarshalInspectable.FromAbi(__retval); - } - finally - { - MarshalInspectable.DisposeAbi(__retval); - } - } - } -} - namespace WinRT.Host { - internal class ActivationFactory : IActivationFactory + internal partial class ActivationFactory : WinRT.Interop.IActivationFactory { public ConstructorInfo Constructor { get; private set; } public ActivationFactory(ConstructorInfo constructor) => Constructor = constructor; + + public IntPtr ActivateInstance() + { + return MarshalInspectable.FromManaged(Constructor.Invoke(null)); + } - public object ActivateInstance() => Constructor.Invoke(null); } } -#endregion - namespace WinRT { public static class Module @@ -140,7 +54,7 @@ public static unsafe IntPtr GetActivationFactory(String runtimeClassId) namespace TestHost { - public class ProbeByHost : IStringable + public partial class ProbeByHost : IStringable { #if NET [UnconditionalSuppressMessage("SingleFile", "IL3000", Justification = "We're not publishing this test as single file.")] diff --git a/src/Projections/TestHost.ProbeByClass/TestHost.ProbeByClass.cs b/src/Projections/TestHost.ProbeByClass/TestHost.ProbeByClass.cs index 5832d50b7..e717395ce 100644 --- a/src/Projections/TestHost.ProbeByClass/TestHost.ProbeByClass.cs +++ b/src/Projections/TestHost.ProbeByClass/TestHost.ProbeByClass.cs @@ -7,108 +7,21 @@ using Windows.Foundation; using WinRT; - -#region Temporary, until authoring support generates activation factory support - -namespace Windows.Foundation -{ - [global::WinRT.WindowsRuntimeType] - [Guid("00000035-0000-0000-c000-000000000046")] - [WindowsRuntimeHelperType(typeof(global::ABI.Windows.Foundation.IActivationFactory))] - internal interface IActivationFactory - { - Object ActivateInstance(); - } -} - -namespace ABI.Windows.Foundation -{ -#if !NET - [global::WinRT.ObjectReferenceWrapper(nameof(_obj))] -#endif - [Guid("00000035-0000-0000-c000-000000000046")] - internal class IActivationFactory : global::Windows.Foundation.IActivationFactory - { - public unsafe delegate int ActivateInstance_0(IntPtr thisPtr, out IntPtr instance); - - [Guid("00000035-0000-0000-c000-000000000046")] - public struct Vftbl - { - internal IInspectable.Vftbl IInspectableVftbl; - public ActivateInstance_0 ActivateInstance_0; - - private static readonly Vftbl AbiToProjectionVftable; - public static readonly IntPtr AbiToProjectionVftablePtr; - static unsafe Vftbl() - { - AbiToProjectionVftable = new Vftbl - { - IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable, - ActivateInstance_0 = Do_Abi_ActivateInstance_0 - }; - var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf() + sizeof(IntPtr) * 1); - Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); - AbiToProjectionVftablePtr = (IntPtr)nativeVftbl; - } - - private static unsafe int Do_Abi_ActivateInstance_0(IntPtr thisPtr, out IntPtr instance) - { - object __instance = default; - instance = default; - try - { - __instance = global::WinRT.ComWrappersSupport.FindObject(thisPtr).ActivateInstance(); - instance = MarshalInspectable.FromManaged(__instance); - } - catch (Exception __exception__) - { - global::WinRT.ExceptionHelpers.SetErrorInfo(__exception__); - return global::WinRT.ExceptionHelpers.GetHRForException(__exception__); - } - return 0; - } - } - internal static ObjectReference FromAbi(IntPtr thisPtr) => ObjectReference.FromAbi(thisPtr, global::WinRT.Interop.IID.IID_IActivationFactory); - - protected readonly ObjectReference _obj; - public IObjectReference ObjRef { get => _obj; } - public IntPtr ThisPtr => _obj.ThisPtr; - public IActivationFactory(IObjectReference obj) : this(obj.As(global::WinRT.Interop.IID.IID_IActivationFactory)) { } - internal IActivationFactory(ObjectReference obj) - { - _obj = obj; - } - - public unsafe object ActivateInstance() - { - IntPtr __retval = default; - try - { - global::WinRT.ExceptionHelpers.ThrowExceptionForHR(_obj.Vftbl.ActivateInstance_0(ThisPtr, out __retval)); - return MarshalInspectable.FromAbi(__retval); - } - finally - { - MarshalInspectable.DisposeAbi(__retval); - } - } - } -} - namespace WinRT.Host { - internal class ActivationFactory : IActivationFactory + internal partial class ActivationFactory : WinRT.Interop.IActivationFactory { public ConstructorInfo Constructor { get; private set; } public ActivationFactory(ConstructorInfo constructor) => Constructor = constructor; - public object ActivateInstance() => Constructor.Invoke(null); + public IntPtr ActivateInstance() + { + return MarshalInspectable.FromManaged(Constructor.Invoke(null)); + } } } -#endregion - namespace WinRT { public static class Module @@ -140,7 +53,7 @@ public static unsafe IntPtr GetActivationFactory(string runtimeClassId) namespace TestHost { - public class ProbeByClass : IStringable + public partial class ProbeByClass : IStringable { #if NET [UnconditionalSuppressMessage("SingleFile", "IL3000", Justification = "We're not publishing this test as single file.")] From 2807efd6b22940979acdb2c2d6553e6c54788fd3 Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Sun, 24 Nov 2024 01:56:52 -0800 Subject: [PATCH 13/14] Add TFM check --- nuget/Microsoft.Windows.CsWinRT.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nuget/Microsoft.Windows.CsWinRT.targets b/nuget/Microsoft.Windows.CsWinRT.targets index 4e0203a83..41bb4594c 100644 --- a/nuget/Microsoft.Windows.CsWinRT.targets +++ b/nuget/Microsoft.Windows.CsWinRT.targets @@ -60,6 +60,10 @@ Copyright (C) Microsoft Corporation. All rights reserved. + + + + From 51a495088cb440ce6bac695bac94ba262f27a44c Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Sun, 24 Nov 2024 18:02:43 -0800 Subject: [PATCH 14/14] Update src/WinRT.Runtime/WinRT.Runtime.csproj --- src/WinRT.Runtime/WinRT.Runtime.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WinRT.Runtime/WinRT.Runtime.csproj b/src/WinRT.Runtime/WinRT.Runtime.csproj index fd9779e5b..cffdb38aa 100644 --- a/src/WinRT.Runtime/WinRT.Runtime.csproj +++ b/src/WinRT.Runtime/WinRT.Runtime.csproj @@ -97,7 +97,7 @@ - + <_ReferencePathDirectories Include="@(ReferencePath -> '%(RootDir)%(Directory)')" />