Skip to content

Commit

Permalink
Merge pull request #2616 from cwensley/curtis/update-to-net6
Browse files Browse the repository at this point in the history
Update WinForms/Wpf/Direct2D and templates to net6.0
  • Loading branch information
cwensley authored Feb 10, 2024
2 parents 121c417 + 36a83c7 commit d7ad8fe
Show file tree
Hide file tree
Showing 24 changed files with 672 additions and 721 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>
18 changes: 4 additions & 14 deletions src/Eto.Direct2D/Eto.Direct2D.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
<Project>
<Project Sdk="Microsoft.NET.Sdk">

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

<TargetFrameworks>netcoreapp3.1;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>
<TargetFrameworks Condition="$(TargetFrameworkOverride) == ''">net6.0-windows;net462</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) != ''">$(TargetFrameworkOverride)</TargetFrameworks>
<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 +53,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
3 changes: 2 additions & 1 deletion src/Eto.Gtk/Eto.Gtk.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) == ''">netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) != ''">$(TargetFrameworkOverride)</TargetFrameworks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<RootNamespace>Eto.GtkSharp</RootNamespace>
<DefineConstants>$(DefineConstants);GTK3;GTKCORE</DefineConstants>
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
3 changes: 2 additions & 1 deletion src/Eto.Mac/Eto.Mac64.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) == ''">netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) != ''">$(TargetFrameworkOverride)</TargetFrameworks>
<RootNamespace>Eto.Mac</RootNamespace>
<DefineConstants>$(DefineConstants);OSX;DESKTOP;MONOMAC;Mac64</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
4 changes: 2 additions & 2 deletions src/Eto.Mac/Eto.XamMac2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<UseXamarinMac Condition="$(UseXamarinMac) == ''">True</UseXamarinMac>
<TargetFrameworks Condition="$(OverrideTargetFrameworks) != 'True'">net462;xamarinmac20</TargetFrameworks>
<TargetFrameworks Condition="$(OverrideTargetFrameworks) != 'True' AND $([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), '6.0')) AND $([MSBuild]::VersionLessThan($(NETCoreSdkVersion), '6.0.200'))">net6.0-macos10.15;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) == ''">net462;xamarinmac20</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) != ''">$(TargetFrameworkOverride)</TargetFrameworks>
<RootNamespace>Eto.Mac</RootNamespace>
<DefineConstants>$(DefineConstants);OSX;DESKTOP;XAMMAC;XAMMAC2;UNIFIED</DefineConstants>
<DefineConstants Condition="$(UseCFString) != 'False'">$(DefineConstants);USE_CFSTRING</DefineConstants>
Expand Down
21 changes: 7 additions & 14 deletions src/Eto.WinForms/Eto.WinForms.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

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

<TargetFrameworks>netcoreapp3.1;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" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="$(TargetFrameworkOverride) == ''">net6.0-windows;net461</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) != ''">$(TargetFrameworkOverride)</TargetFrameworks>
<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 @@ -116,6 +108,9 @@ You do not need to use any of the classes of this assembly (unless customizing t
<Compile Include="..\Eto.Wpf\Forms\KeyboardHandler.cs">
<Link>Forms\KeyboardHandler.cs</Link>
</Compile>
<Compile Include="..\Shared\HttpClientExtensions.cs">
<Link>HttpClientExtensions.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
Expand All @@ -132,8 +127,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
34 changes: 8 additions & 26 deletions src/Eto.Wpf/Eto.Wpf.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
<Project>

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

<TargetFrameworks>netcoreapp3.1;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" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="$(TargetFrameworkOverride) == ''">net6.0-windows;net462</TargetFrameworks>
<TargetFrameworks Condition="$(TargetFrameworkOverride) != ''">$(TargetFrameworkOverride)</TargetFrameworks>
<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 @@ -140,6 +133,9 @@ You do not need to use any of the classes of this assembly (unless customizing t
<Compile Include="..\Shared\OpenTypeFontInfo.cs">
<Link>Drawing\OpenTypeFontInfo.cs</Link>
</Compile>
<Compile Include="..\Shared\HttpClientExtensions.cs">
<Link>HttpClientExtensions.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
Expand All @@ -151,17 +147,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 +157,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>
4 changes: 2 additions & 2 deletions src/Eto.Wpf/Forms/Controls/CalendarHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public DateTime MinDate
var currentMonth = Control.DisplayDate;
Control.DisplayDateStart = value == DateTime.MinValue ? (DateTime?)null : value;
Control.DisplayDate = currentMonth;
if (SelectedDate != null && SelectedDate < value)
if (SelectedDate < value)
SelectedDate = value;
}
}
Expand All @@ -83,7 +83,7 @@ public DateTime MaxDate
set
{
Control.DisplayDateEnd = value == DateTime.MaxValue ? (DateTime?)null : value;
if (SelectedDate != null && SelectedDate > value)
if (SelectedDate > value)
SelectedDate = value;
}
}
Expand Down
Loading

0 comments on commit d7ad8fe

Please sign in to comment.