Skip to content

Commit

Permalink
Update WinForms/Wpf/Direct2D and templates to net6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensley committed Feb 10, 2024
1 parent 121c417 commit 5474698
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 150 deletions.
22 changes: 1 addition & 21 deletions samples/Wpf/EmbedEtoInWpf/EmbedEtoInWpf.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<HaveWindowsDesktopSdk Condition="$(HaveWindowsDesktopSdk) == '' and $(OS) == 'Windows_NT'">true</HaveWindowsDesktopSdk>

<TargetFrameworks>net48;net6.0-windows</TargetFrameworks>
</PropertyGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.props" />

<PropertyGroup>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
Expand All @@ -30,18 +25,6 @@
<Reference Include="PresentationFramework" />
</ItemGroup>

<!-- Automatically added by WindowsDesktop SDK -->
<ItemGroup Condition="$(HaveWindowsDesktopSdk) == 'False'">
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>

<ItemGroup>
<Compile Update="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
Expand Down Expand Up @@ -77,7 +60,4 @@
<ProjectReference Include="..\..\..\src\Eto\Eto.csproj" />
</ItemGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.targets" />

</Project>
18 changes: 1 addition & 17 deletions samples/Wpf/EmbedWpfInEto/EmbedWpfInEto.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<HaveWindowsDesktopSdk Condition="$(HaveWindowsDesktopSdk) == '' and $(OS) == 'Windows_NT'">true</HaveWindowsDesktopSdk>

<TargetFrameworks>net48;net6.0-windows</TargetFrameworks>
</PropertyGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.props" />

<PropertyGroup>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
Expand Down Expand Up @@ -36,20 +31,9 @@
</Compile>
</ItemGroup>

<!-- Automatically added by WindowsDesktop SDK -->
<ItemGroup Condition="$(HaveWindowsDesktopSdk) == 'False'">
<Page Include="MyNativeControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Eto.Wpf\Eto.Wpf.csproj" />
<ProjectReference Include="..\..\..\src\Eto\Eto.csproj" />
</ItemGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.targets" />

</Project>
14 changes: 3 additions & 11 deletions src/Eto.Direct2D/Eto.Direct2D.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<HaveWindowsDesktopSdk Condition="$(HaveWindowsDesktopSdk) == '' and $(OS) == 'Windows_NT'">true</HaveWindowsDesktopSdk>

<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks>
<TargetFrameworks>net6.0-windows;net462</TargetFrameworks>
</PropertyGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.props" />

<PropertyGroup>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);WINFORMS</DefineConstants>
<UseWindowsForms Condition="$(HaveWindowsDesktopSdk) == 'True'">true</UseWindowsForms>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -60,8 +55,5 @@ You do not need to use any of the classes of this assembly (unless customizing t
<PackageReference Include="SharpDX.Direct2D1" Version="4.2.0" />
<PackageReference Include="SharpDX.Mathematics" Version="4.2.0" />
</ItemGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.targets" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@
"type": "parameter",
"description": "Specify the framework(s) to support",
"dataType": "choice",
"defaultValue": "net6.0",
"defaultValue": "net8.0",
"replaces": "net6.0",
"choices": [
{
"choice": "net6.0",
"description": ".NET 6.0"
"choice": "net8.0",
"description": ".NET 8.0"
},
{
"choice": "net5.0",
"description": ".NET 5.0"
"choice": "net7.0",
"description": ".NET 7.0"
},
{
"choice": "netcoreapp3.1",
"description": ".NET Core 3.1"
"choice": "net6.0",
"description": ".NET 6.0"
},
{
"choice": "net48",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@
"type": "parameter",
"description": "Specify the framework(s) to support",
"dataType": "choice",
"defaultValue": "net6.0",
"defaultValue": "net8.0",
"replaces": "net6.0",
"choices": [
{
"choice": "net6.0",
"description": ".NET 6.0"
"choice": "net8.0",
"description": ".NET 8.0"
},
{
"choice": "net5.0",
"description": ".NET 5.0"
"choice": "net7.0",
"description": ".NET 7.0"
},
{
"choice": "netcoreapp3.1",
"description": ".NET Core 3.1"
"choice": "net6.0",
"description": ".NET 6.0"
},
{
"choice": "net48",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@
"type": "parameter",
"description": "Specify the framework(s) to support",
"dataType": "choice",
"defaultValue": "net6.0",
"defaultValue": "net8.0",
"replaces": "net6.0",
"choices": [
{
"choice": "net6.0",
"description": ".NET 6.0"
"choice": "net8.0",
"description": ".NET 8.0"
},
{
"choice": "net5.0",
"description": ".NET 5.0"
"choice": "net7.0",
"description": ".NET 7.0"
},
{
"choice": "netcoreapp3.1",
"description": ".NET Core 3.1"
"choice": "net6.0",
"description": ".NET 6.0"
},
{
"choice": "net48",
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.Gtk/Forms/LinuxTrayIndicatorHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public bool Visible

public LinuxTrayIndicatorHandler()
{
#if NETCOREAPP
#if NET
NativeLibrary.SetDllImportResolver(typeof(LinuxTrayIndicatorHandler).Assembly, (name, assembly, path) =>
{
// Use custom import resolver for libappindicator
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.Gtk/NativeMethods.tt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace Eto.GtkSharp
static class <#= pclass[i] #>
{

#if NETCOREAPP
#if NET

static <#= pclass[i] #>()
{
Expand Down
14 changes: 3 additions & 11 deletions src/Eto.WinForms/Eto.WinForms.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<HaveWindowsDesktopSdk Condition="$(HaveWindowsDesktopSdk) == '' and $(OS) == 'Windows_NT'">true</HaveWindowsDesktopSdk>

<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>net6.0-windows;net461</TargetFrameworks>
</PropertyGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.props" />

<PropertyGroup>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);WINFORMS</DefineConstants>
<NoWarn>MSB4011;$(NoWarn)</NoWarn>
<UseWindowsForms Condition="$(HaveWindowsDesktopSdk) == 'True'">true</UseWindowsForms>
<UseWindowsForms>true</UseWindowsForms>
<GenerateResourceUsePreserializedResources>True</GenerateResourceUsePreserializedResources>
</PropertyGroup>

Expand Down Expand Up @@ -132,8 +126,6 @@ You do not need to use any of the classes of this assembly (unless customizing t
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
</ItemGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.targets" />
<ItemGroup>
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.WinForms/Forms/Controls/TextStepperHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class EtoUpDown : swf.UpDownBase
public event EventHandler DownButtonClicked;
public event EventHandler UpButtonClicked;

#if NETCOREAPP
#if NET
static FieldInfo DefaultButtonsWidthField = typeof(swf.UpDownBase).GetField("_defaultButtonsWidth", BindingFlags.Static | BindingFlags.NonPublic);
static FieldInfo TextBoxField = typeof(swf.UpDownBase).GetField("_upDownEdit", BindingFlags.Instance | BindingFlags.NonPublic);
static FieldInfo UpDownButtonsField = typeof(swf.UpDownBase).GetField("_upDownButtons", BindingFlags.Instance | BindingFlags.NonPublic);
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.WinForms/ScrollMessageFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static bool IsScrollable(swf.Control control)
if (p != null)
return p.AutoScroll;
return control is swf.DataGridView
#if !NETCOREAPP3_1
#if NETFRAMEWORK
|| control is swf.DataGrid
#endif
|| control is swf.TreeView
Expand Down
27 changes: 4 additions & 23 deletions src/Eto.Wpf/Eto.Wpf.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<HaveWindowsDesktopSdk Condition="$(HaveWindowsDesktopSdk) == '' and $(OS) == 'Windows_NT'">true</HaveWindowsDesktopSdk>

<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks>
<TargetFrameworks>net6.0-windows;net462</TargetFrameworks>
</PropertyGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.props" />

<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Eto.Wpf</RootNamespace>
<AssemblyName>Eto.Wpf</AssemblyName>
<RestorePackages>true</RestorePackages>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);WPF</DefineConstants>
<UseWPF Condition="$(HaveWindowsDesktopSdk) == 'True'">true</UseWPF>
<UseWindowsForms Condition="$(HaveWindowsDesktopSdk) == 'True'">true</UseWindowsForms>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<!-- Suppress warning NU1701: Package 'Extended.Wpf.Toolkit 3.2.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v3.0'. This package may not be fully compatible with your project. -->
<NoWarn>NU1701;MSB4011;$(NoWarn)</NoWarn>
</PropertyGroup>
Expand Down Expand Up @@ -151,17 +146,6 @@ You do not need to use any of the classes of this assembly (unless customizing t
<EmbeddedResource Include="XPThemes.manifest" />
</ItemGroup>

<!-- Automatically added by WindowsDesktop SDK -->
<ItemGroup Condition="'$(HaveWindowsDesktopSdk)' != 'true'">
<Page Include="**\*.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Update="**\*.xaml.cs">
<DependentUpon>$([System.String]::Copy('%(Filename)').Replace('.xaml', ''))%(Extension)</DependentUpon>
</Compile>
<None Remove="**\*.xaml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Eto\Eto.csproj" />
</ItemGroup>
Expand All @@ -172,7 +156,4 @@ You do not need to use any of the classes of this assembly (unless customizing t
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1938.49" PrivateAssets="all" />
</ItemGroup>

<Import Condition="'$(HaveWindowsDesktopSdk)' != 'true'" Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<Import Condition="'$(HaveWindowsDesktopSdk)' == 'true'" Sdk="Microsoft.NET.Sdk.WindowsDesktop" Project="Sdk.targets" />

</Project>
36 changes: 0 additions & 36 deletions src/Eto/Forms/Binding/ICommand.cs

This file was deleted.

5 changes: 0 additions & 5 deletions src/Eto/Forms/Controls/Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ namespace Eto.Forms;
/// All visual user interface elements should inherit from this class to provide common functionality like binding,
/// load/unload, and common events.
/// </remarks>
#if !NETSTANDARD && !NETCOREAPP
[ToolboxItem(true)]
[DesignTimeVisible(true)]
[DesignerCategory("Eto.Forms")]
#endif
[sc.TypeConverter(typeof(ControlConverter))]
public partial class Control : BindableWidget, IMouseInputSource, IKeyboardInputSource, ICallbackSource
{
Expand Down
2 changes: 1 addition & 1 deletion src/Eto/PclTypes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD || NETCOREAPP
#if NETSTANDARD || NET
// This file contains type definitions currently needed to compile Eto
// as a Portable Class Library, in the project Eto.Pcl.csproj.
namespace Eto
Expand Down

0 comments on commit 5474698

Please sign in to comment.