ookii-dialogs / ookii-dialogs-wpf

Awesome dialogs for Windows Desktop applications built with Microsoft .NET (WPF)
BSD 3-Clause "New" or "Revised" License
1.14k stars 85 forks source link

Need .Net Core 3.0 Prerelease Version #5

Closed stricq closed 3 years ago

stricq commented 5 years ago

Need .Net Core 3.0 Prerelease Version

augustoproiete commented 5 years ago

Thanks @stricq.

.NET Core 3.0 support is definitely a goal. I might start working on this after RTM ships, though, so if pre-release version is something you care about, I'd be happy to get a PR

cheesi commented 5 years ago

What is the current state on this issue?

hillin commented 4 years ago

A mild bump, we are migrating our WPF projects to .NET Core, it would be great if we can migrate the Ookii libs ASAP.

lklauder commented 4 years ago

I installed the existing framework version in a Core 3.1 project and have a compiler warning about the package having been restored using various framework versions up through 4.8 rather than Core 3.1 and that it may not be fully compatible with my project. However, it seems to compile and work ok for the following usage:

     var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog( );
     dialog.Description = "choose folder in which to store scripts for this project";
     dialog.RootFolder = Environment.SpecialFolder.MyComputer;  // not implemented
     dialog.ShowNewFolderButton = true;
     dialog.UseDescriptionForTitle = true;

     bool result = dialog.ShowDialog( this ).GetValueOrDefault( );

What happens if the Ookii code is pasted into the files of a new Core 3.1 project? It would be nice to get the RootFolder property implemented in VistaFolderBrowserDialog.

hillin commented 4 years ago

Using the .NET Framework assembly in a .NET Core project has two consequences:

  1. The project will only run on Windows. Since it's a WPF project and the underlying API this library uses are only available on Windows, this is not a concern;
  2. If the .NET Framework assembly uses some API that does not exist in .NET Core, runtime exception will be thrown. As we've already been using this library in our .NET Core project for a while and none of such exceptions occurred, I guess this is not a problem too.

So in general, if you can bear with the compiler warning, it seems pretty safe to use this library in a .NET Core project. I still hope we can get the .NET Core version though.

haruby511 commented 4 years ago

The TaskDialog is not working in .NET Core 3.1. But VistaFolderBrowserDialog and ProgressDialog have not problem.

Below exception thrown from TaskDialog.ShowDialog().

System.EntryPointNotFoundException Unable to find an entry point named 'TaskDialogIndirect' in DLL 'comctl32.dll'.

I've also tried #7 but same result.

The OS is Windows 10 1909.

Reproduce

  1. Create WPF(.NET Core) project in Visual Studio 2019.
  2. Add below code to .ctor of MainWindow.
    TaskDialog taskDialog = new TaskDialog()
    {
    WindowTitle = "Title",
    MainIcon = TaskDialogIcon.Information,
    MainInstruction = "test",
    Content = "TEST",
    ExpandedInformation = "detail"
    };
    taskDialog.Buttons.Add(new TaskDialogButton(ButtonType.Ok));
    taskDialog.ShowDialog();
  3. Build and Run.
FirehawkV21 commented 3 years ago

@haruby511 I had this issue as well. But it only needs a bit of editing in your project so the library can access the TaskDialog.

  1. Add an app.manifest.
  2. Open the manifest file. You'll see this bit:
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>

Uncomment this.

  1. Right-click on the project and click properties.
  2. In the "Application" tab, pick the manifest file from the list.

That should fix the issue.

augustoproiete commented 3 years ago

GitHub automatically closed this issue with the merge of PR #7, so I'm re-opening. I'm planning on releasing a pre-release package over the coming weekend.

augustoproiete commented 3 years ago

Ookii.Dialogs.Wpf 2.0.0-preview1 has been published on nuget.org

Install-Package Ookii.Dialogs.Wpf -Version 2.0.0-preview1

Please test in your apps and report any issues you find.


Thanks to @acemod13 for doing all the work!

augustoproiete commented 3 years ago

Stable version with .NET 3.1 support has been published to nuget.org: Ookii.Dialogs.Wpf 2.0.0

Install-Package Ookii.Dialogs.Wpf -Version 2.0.0

N.B.: WPF apps on .NET Core 3.1 need to declare an application manifest in order to use Ookii Dialogs. The manifest was added automatically in .NET Framework apps, but with .NET Core 3.1 this is no longer the case, so there's a little extra step that the developer needs to do. More details on the README of this repo.


Thanks again to @acemod13 for the contribution! /cc @stricq @cheesi @lklauder @hillin @haruby511 @vpenades @Agagamand @NateTheGreat714 @andreasgrosche