0
votes

Microsoft documentation for .Net Core 3.1 says there is a MessageBox Class. If so, what is the NuGet package I need to download?

https://docs.microsoft.com/en-us/dotnet/api/system.windows.messagebox?view=netcore-3.1

2
It's included in the dotnet core starting 3.1. Just make sure your project targets that version, and then in your project reference setting make sure you uses System.Windows - texasbruce
Thanks, that did it. I spent an hour researching this topic, tried various things from System.Windows.MessageBox.Show() to just plain MessageBox.Show() and nothing worked. You replied and now it works as expected....I am chasing ghosts! - user610342
I see I was not actually chasing ghosts. MessageBox.Show() does indeed appear in a .Net Core 3.1 Windows Application and works there BUT I was also trying to use it in a .Net Core 3.1 Class Library which is where it does not appear. Hence, question persists: can I use MessageBox in a class library? - user610342

2 Answers

0
votes

Not sure you would want a Windows message box 'showing' in your class library; surely your other UI projects which rely on your class library, would be the place where any dialog boxes need to be shown in the UI?

0
votes

The answer for me was to create a project in the solution using .Net framework. Specifically a Project/Class called NetFrame/Bridge. Then my .Net core projects in the solutions can call the .Framework project's one line method for MessageBox.

I am happy to report than having moved 250k lines of code from .Net Framework to .Net Core MessageBox is the ONLY method I had to add to the Bridge class!