C
C#3d ago
Beast

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
Beast
BeastOP3d ago
No description
Beast
BeastOP3d ago
is there any way to not have to add that extra stuff
Buddy
Buddy3d ago
Do you use WPF? or what do you use?
Beast
BeastOP3d ago
Normally no but I want to make something that looks modern in wpf
Buddy
Buddy3d ago
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
Beast
BeastOP3d ago
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
Buddy
Buddy3d ago
Anytime.
Beast
BeastOP3d ago
Ill have to upgrade my .NET version tho
Buddy
Buddy3d ago
Microsoft
Upgrade Assistant | .NET
Upgrade your projects from .NET Framework to .NET.
Buddy
Buddy3d ago
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!
Beast
BeastOP3d ago
Gotcha

Did you find this page helpful?