Skip to content

Commit

Permalink
Merge pull request #25 from augustoproiete/dotnet5
Browse files Browse the repository at this point in the history
Add support for .NET 5
  • Loading branch information
augustoproiete authored Nov 15, 2020
2 parents a20e3cd + 031df4e commit 7dd5098
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

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

[![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)

[![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)
</div>

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

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.

## .NET Core 3.1 pre-requisites
## .NET Core 3.1 & .NET 5 pre-requisites

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`.
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`.

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

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"allowPrerelease": false,
"version": "3.1.100",
"version": "5.0.100",
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<OutputType>WinExe</OutputType>
<SupportedOSPlatform>windows7</SupportedOSPlatform>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Ookii.Dialogs.Wpf.Sample</RootNamespace>
Expand Down
6 changes: 6 additions & 0 deletions src/Ookii.Dialogs.Wpf/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[*.cs]
# SYSLIB0003: Type or member is obsolete
dotnet_diagnostic.SYSLIB0003.severity = none

# SYSLIB0004: Type or member is obsolete
dotnet_diagnostic.SYSLIB0004.severity = none
9 changes: 7 additions & 2 deletions src/Ookii.Dialogs.Wpf/Ookii.Dialogs.Wpf.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net45</TargetFrameworks>
<TargetFrameworks>net5.0-windows;netcoreapp3.1;net45</TargetFrameworks>
<SupportedOSPlatform>windows7</SupportedOSPlatform>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Ookii.Dialogs.Wpf</RootNamespace>

<AssemblyName>Ookii.Dialogs.Wpf</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
Expand Down Expand Up @@ -40,6 +41,10 @@
<DefineConstants>$(DefineConstants);NETCORE31</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0-windows' ">
<DefineConstants>$(DefineConstants);NET5</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<MinClientVersion>3.3</MinClientVersion>
<PackageId>Ookii.Dialogs.Wpf</PackageId>
Expand Down
4 changes: 2 additions & 2 deletions src/Ookii.Dialogs.Wpf/VistaFolderBrowserDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ private bool RunDialogDownlevel(IntPtr owner)
}
finally
{
if( rootItemIdList != null )
if( rootItemIdList != IntPtr.Zero )
{
IMalloc malloc = NativeMethods.SHGetMalloc();
malloc.Free(rootItemIdList);
Marshal.ReleaseComObject(malloc);
}
if( resultItemIdList != null )
if( resultItemIdList != IntPtr.Zero )
{
Marshal.FreeCoTaskMem(resultItemIdList);
}
Expand Down

0 comments on commit 7dd5098

Please sign in to comment.