I'm migrating my WPF desktop app from .NET Framework to Core 3.0. I was using System.Windows.Forms.FolderBrowserDialog() and I'm now stuck on how to add this reference to the Core project. There is no "System.Windows.Forms" NuGet package available, is there? Is there any alternative way to display the FolderBrowserDialog in Core?
Update
I created the Core project using the default template and then copied and pasted .cs and .xaml files into it. The .csproj file looks like this:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>netcoreapp3.0</TargetFramework> <UseWPF>true</UseWPF> </PropertyGroup>
Click on File >> New >> Project menu and select WPF Application from Templates as shown in Figure 1. In Solution Explorer, right click on References node and select Add Reference menu item. On Browse tab, go to "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3. 0" folder and select WindowsFormsIntegration.
You can use the WindowsFormsHost to add single Forms into an WPF application.
Forms as a reference in your project. Right-click on 'References' , select 'Add Reference' and look under Assemblies in the dialogue. If you created your project as a Windows Forms project, that reference should have been added for you automatically.
You need to add to csproj an additional switch:
<UseWindowsForms>true</UseWindowsForms>
Add it below UseWpf. Then try rebuild. After this, you should be able to use Forms namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With