Skip to content

Commit 7dd5098

Browse files
Merge pull request #25 from augustoproiete/dotnet5
Add support for .NET 5
2 parents a20e3cd + 031df4e commit 7dd5098

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
A class library for WPF applications providing several common dialogs. Included are classes for task dialogs, credential dialogs, progress dialogs, and common file dialogs.
1414

15-
[![NuGet Version](http://img.shields.io/nuget/v/Ookii.Dialogs.Wpf.svg?style=flat)](https://www.nuget.org/packages/Ookii.Dialogs.Wpf) [![NuGet Downloads](https://img.shields.io/nuget/dt/Ookii.Dialogs.Wpf.svg)](https://www.nuget.org/packages/Ookii.Dialogs.Wpf) [![.NET Framework](https://img.shields.io/badge/.NET%20Framework-%3E%3D%204.5-informational)](https://dotnet.microsoft.com/download) [![.NET Core](https://img.shields.io/badge/.NET%20Core-%3E%3D%203.1.0-informational)](https://dotnet.microsoft.com/download)
16-
15+
[![NuGet Version](http://img.shields.io/nuget/v/Ookii.Dialogs.Wpf.svg?style=flat)](https://www.nuget.org/packages/Ookii.Dialogs.Wpf) [![NuGet Downloads](https://img.shields.io/nuget/dt/Ookii.Dialogs.Wpf.svg)](https://www.nuget.org/packages/Ookii.Dialogs.Wpf) [![.NET](https://img.shields.io/badge/.NET%20-%3E%3D%205.0-informational)](https://dotnet.microsoft.com/download) [![.NET Core](https://img.shields.io/badge/.NET%20Core-%3E%3D%203.1-informational)](https://dotnet.microsoft.com/download) [![.NET Framework](https://img.shields.io/badge/.NET%20Framework-%3E%3D%204.5-informational)](https://dotnet.microsoft.com/download)
1716
</div>
1817

1918
## Give a Star! :star:
@@ -82,9 +81,9 @@ The `Ookii.Dialogs.Wpf.VistaOpenFileDialog`, `Ookii.Dialogs.Wpf.VistaSaveFileDia
8281

8382
The classes have been designed to resemble the original WPF classes to make it easy to switch. When the classes are used on Windows XP, they will automatically fall back to the old style dialog; this is also true for the `VistaFolderBrowserDialog`; that class provides a complete implementation of a folder browser dialog for WPF, old as well as new style.
8483

85-
## .NET Core 3.1 pre-requisites
84+
## .NET Core 3.1 & .NET 5 pre-requisites
8685

87-
Ookii Dialogs leverages the components and visual styles of the Windows Common Controls library (`comctl32.dll`), and WPF applications targeting .NET Core 3.1 must add an [application manifest](https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests) (`app.manifest`) to their projects with a reference to `Microsoft.Windows.Common-Controls`.
86+
Ookii Dialogs leverages the components and visual styles of the Windows Common Controls library (`comctl32.dll`), and WPF applications targeting .NET Core 3.1 and/or .NET 5 must add an [application manifest](https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests) (`app.manifest`) to their projects with a reference to `Microsoft.Windows.Common-Controls`.
8887

8988
Without the application manifest, you'll get an error with a message similar to the below:
9089

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
33
"allowPrerelease": false,
4-
"version": "3.1.100",
4+
"version": "5.0.100",
55
"rollForward": "latestFeature"
66
}
77
}

sample/Ookii.Dialogs.Wpf.Sample/Ookii.Dialogs.Wpf.Sample.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45;netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>net45;netcoreapp3.1;net5.0-windows</TargetFrameworks>
55
<OutputType>WinExe</OutputType>
6+
<SupportedOSPlatform>windows7</SupportedOSPlatform>
67
<UseWPF>true</UseWPF>
78
<UseWindowsForms>true</UseWindowsForms>
89
<RootNamespace>Ookii.Dialogs.Wpf.Sample</RootNamespace>

src/Ookii.Dialogs.Wpf/.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[*.cs]
2+
# SYSLIB0003: Type or member is obsolete
3+
dotnet_diagnostic.SYSLIB0003.severity = none
4+
5+
# SYSLIB0004: Type or member is obsolete
6+
dotnet_diagnostic.SYSLIB0004.severity = none

src/Ookii.Dialogs.Wpf/Ookii.Dialogs.Wpf.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net45</TargetFrameworks>
4+
<TargetFrameworks>net5.0-windows;netcoreapp3.1;net45</TargetFrameworks>
5+
<SupportedOSPlatform>windows7</SupportedOSPlatform>
56
<UseWPF>true</UseWPF>
67
<UseWindowsForms>true</UseWindowsForms>
78
<RootNamespace>Ookii.Dialogs.Wpf</RootNamespace>
89

910
<AssemblyName>Ookii.Dialogs.Wpf</AssemblyName>
10-
<AssemblyVersion>2.0.0.0</AssemblyVersion>
11+
<AssemblyVersion>3.0.0.0</AssemblyVersion>
1112
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
1213
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
1314
<GenerateDocumentationFile>false</GenerateDocumentationFile>
@@ -40,6 +41,10 @@
4041
<DefineConstants>$(DefineConstants);NETCORE31</DefineConstants>
4142
</PropertyGroup>
4243

44+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0-windows' ">
45+
<DefineConstants>$(DefineConstants);NET5</DefineConstants>
46+
</PropertyGroup>
47+
4348
<PropertyGroup>
4449
<MinClientVersion>3.3</MinClientVersion>
4550
<PackageId>Ookii.Dialogs.Wpf</PackageId>

src/Ookii.Dialogs.Wpf/VistaFolderBrowserDialog.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ private bool RunDialogDownlevel(IntPtr owner)
232232
}
233233
finally
234234
{
235-
if( rootItemIdList != null )
235+
if( rootItemIdList != IntPtr.Zero )
236236
{
237237
IMalloc malloc = NativeMethods.SHGetMalloc();
238238
malloc.Free(rootItemIdList);
239239
Marshal.ReleaseComObject(malloc);
240240
}
241-
if( resultItemIdList != null )
241+
if( resultItemIdList != IntPtr.Zero )
242242
{
243243
Marshal.FreeCoTaskMem(resultItemIdList);
244244
}

0 commit comments

Comments
 (0)