Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Setup .NET 6 & 7 & 8
- name: Setup .NET 6 & 7 & 8 & 10
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.427
7.0.120
8.0.403
6.0.428
7.0.410
8.0.420
10.0.203
- name: Restore dependencies
run: dir "C:\Program Files\dotnet\\shared\Microsoft.WindowsDesktop.App\"
- name: Restore dependencies
Expand Down
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<Project>
<PropertyGroup>
<UseNet10 Condition="'$(UseNet10)' == ''">True</UseNet10>
<UseNet8 Condition="'$(UseNet8)' == ''">True</UseNet8>
<UseNet7 Condition="'$(UseNet7)' == ''">True</UseNet7>
<UseNet6 Condition="'$(UseNet6)' == ''">True</UseNet6>
<GenerateWPF Condition="'$(GenerateWPF)' == ''">False</GenerateWPF>
<DefineConstants Condition="'$(GenerateWPF)' == 'True'">$(DefineConstants);USE_WPF</DefineConstants>
<VersionPrefix>0.5.0</VersionPrefix>
Expand Down
14 changes: 8 additions & 6 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
<PropertyGroup>
<DotnetInstallLocation Condition="$(NetCoreRoot) == ''">C:\Program Files\dotnet\</DotnetInstallLocation>
<DotnetInstallLocation Condition="$(NetCoreRoot) != ''">$(NetCoreRoot)</DotnetInstallLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net8.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\8.0.10\Accessibility.dll</AccessibilityLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net10.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\10.0.7\Accessibility.dll</AccessibilityLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net8.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\8.0.26\Accessibility.dll</AccessibilityLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net7.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\7.0.20\Accessibility.dll</AccessibilityLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net6.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\6.0.35\Accessibility.dll</AccessibilityLocation>
<AccessibilityLocation Condition="$(TargetFramework) == 'net6.0'">$(DotnetInstallLocation)shared\Microsoft.WindowsDesktop.App\6.0.36\Accessibility.dll</AccessibilityLocation>
</PropertyGroup>
<ItemGroup>
<Reference Update="Accessibility" Condition="($(TargetFramework) == 'net8.0') or ($(TargetFramework) == 'net7.0') or ($(TargetFramework) == 'net6.0')">
<Reference Update="Accessibility" Condition="($(TargetFramework) == 'net10.0' and $(UseNet10) == 'true') or ($(TargetFramework) == 'net8.0' and $(UseNet8) == 'true') or ($(TargetFramework) == 'net7.0' and $(UseNet7) == 'true') or ($(TargetFramework) == 'net6.0' and $(UseNet6) == 'true')">
<HintPath>$(AccessibilityLocation)</HintPath>
</Reference>
</ItemGroup>
<Target Name="CustomClean" BeforeTargets="CoreBuild">
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net8.0') and (!Exists('$(AccessibilityLocation)'))" />
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net7.0') and (!Exists('$(AccessibilityLocation)'))" />
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net6.0') and (!Exists('$(AccessibilityLocation)'))" />
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net10.0' and $(UseNet10) == 'true') and (!Exists('$(AccessibilityLocation)'))" />
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net8.0' and $(UseNet8) == 'true') and (!Exists('$(AccessibilityLocation)'))" />
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net7.0' and $(UseNet7) == 'true') and (!Exists('$(AccessibilityLocation)'))" />
<Error Text="Accessibility does not exists in location $(AccessibilityLocation)'" Condition="($(TargetFramework) == 'net6.0' and $(UseNet6) == 'true') and (!Exists('$(AccessibilityLocation)'))" />
</Target>

</Project>
3 changes: 2 additions & 1 deletion WinFormsComInterop/WinFormsComInterop.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net10.0</TargetFrameworks>
<!--<TargetFramework>net10.0</TargetFramework>-->
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
Expand Down
33 changes: 32 additions & 1 deletion WinFormsComInterop/WinFormsComWrappers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public unsafe partial class WinFormsComWrappers : ComWrappers
#if !NET8_0_OR_GREATER
static ComWrappers.ComInterfaceEntry* formsFileDialogEventsEntry;
#endif
#if NET10_0_OR_GREATER
static ComWrappers.ComInterfaceEntry* comObjectEntry;
#endif
#if !NET7_0_OR_GREATER
static ComWrappers.ComInterfaceEntry* enumVariantEntry;
#endif
Expand Down Expand Up @@ -128,6 +131,9 @@ static WinFormsComWrappers()
formsWebBrowserEventEntry = CreateWebBrowserEventEntry();
formsFileDialogEventsEntry = CreateFileDialogEventsEntry();
#endif
#if NET10_0_OR_GREATER
comObjectEntry = CreateComObjectEntry();
#endif
#if USE_WPF
oleDropTargetEntry = CreateOleDropTargetEntry();
winbaseTfContextEntry = CreateWinbaseITfContextEntry();
Expand Down Expand Up @@ -221,6 +227,7 @@ static WinFormsComWrappers()
wrapperEntry->Vtable = vtbl;
return wrapperEntry;
}
#if !NET10_0_OR_GREATER

private static void CreatePrimitivesIServiceProviderProxyVtbl(out IntPtr vtbl)
{
Expand All @@ -229,18 +236,29 @@ private static void CreatePrimitivesIServiceProviderProxyVtbl(out IntPtr vtbl)
primitives::Windows.Win32.System.Com.IServiceProvider.PopulateVTable((primitives::Windows.Win32.System.Com.IServiceProvider.Vtbl*)vtblRaw);
vtbl = (System.IntPtr)vtblRaw;
}
#endif
#endif
private static ComInterfaceEntry* CreateAccessibleObjectEntry()
{
CreatePrimitivesIRawElementProviderSimpleProxyVtbl(out var rawElementProviderSimpleVtbl);
#if !NET10_0_OR_GREATER
CreatePrimitivesIServiceProviderProxyVtbl(out var serviceProviderVtbl);
#endif

var comInterfaceEntryMemory = RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(WinFormsComWrappers), sizeof(ComInterfaceEntry) * 2);
var comInterfaceEntryMemory = RuntimeHelpers.AllocateTypeAssociatedMemory(
typeof(WinFormsComWrappers),
sizeof(ComInterfaceEntry)
#if !NET10_0_OR_GREATER
* 2
#endif
);
var wrapperEntry = (ComInterfaceEntry*)comInterfaceEntryMemory.ToPointer();
wrapperEntry[0].IID = IID_IRawElementProviderSimple;
wrapperEntry[0].Vtable = rawElementProviderSimpleVtbl;
#if !NET10_0_OR_GREATER
wrapperEntry[1].IID = IID_IServiceProvider;
wrapperEntry[1].Vtable = serviceProviderVtbl;
#endif
return wrapperEntry;
}
#if !NET8_0_OR_GREATER
Expand Down Expand Up @@ -315,6 +333,19 @@ private static void CreatePrimitivesIServiceProviderProxyVtbl(out IntPtr vtbl)
}
#endif

#if NET10_0_OR_GREATER
private static ComInterfaceEntry* CreateComObjectEntry()
{
CreatePrimitivesIOleClientSiteProxyVtbl(out var vtbl);

var comInterfaceEntryMemory = RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(WinFormsComWrappers), sizeof(ComInterfaceEntry) * 1);
var wrapperEntry = (ComInterfaceEntry*)comInterfaceEntryMemory.ToPointer();
wrapperEntry->IID = IID_IOleClientSite;
wrapperEntry->Vtable = vtbl;
return wrapperEntry;
}
#endif

#if !NET7_0_OR_GREATER
private static ComInterfaceEntry* CreateEnumVariantEntry()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NET8_0_OR_GREATER
#if NET10_0_OR_GREATER
#elif NET8_0_OR_GREATER
namespace Windows.Win32.System.Com;
using global::System;
using global::System.CodeDom.Compiler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net10.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<FileVersion>6.0.0.0</FileVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
Expand Down
2 changes: 1 addition & 1 deletion facades/System.Windows.Forms/System.Windows.Forms.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net10.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<FileVersion>6.0.0.0</FileVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.200",
"version": "10.0.203",
"allowPrerelease": true,
"rollForward": "major"
}
Expand Down
2 changes: 1 addition & 1 deletion samples/SampleWindowsForms/SampleWindowsForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWindowsForms Condition="'$(WinFormsRepoRoot)' == ''">True</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>
Expand Down
Loading