How to avoid error 'MessageBox' is an ambiguous reference between 'System.Windows.Forms.MessageBox'
So basically I wanted to use Folder Open Dialog in wpf so I had to add reference to windows forms but now im getting this error message
11 Replies

is there any way to not have to add that extra stuff
Do you use WPF?
or what do you use?
Normally no but I want to make something that looks modern in wpf
the framework that is
Yeah, WPF comes with its own MessageBox, please use that.
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/windows/how-to-open-message-box
and if you have a modern project (.NET), you can edit it to not include Windows Forms
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props-desktop#usewindowsforms
Just remove this property if it exists
I see, it seems I had tried to use OpenFileDialog from winforms and its causing issues
I missed the fact that theres already a wpf version of it
Thanks
Anytime.
Ill have to upgrade my .NET version tho
Microsoft has an assistant to upgrade a project from .NET Framework to .NET if you use that.
It's not bug-free so make sure you have a backup!
Gotcha