I am creating a .Net Core web application to view log files and other result files that reside on the web server as well as start and stop some applications that produce those files. I see references to OpenFileDialog, but for the life of me can't find how to resolve that reference. I get type or namespace OpenFileDialog cannot be found, are you missing a reference... Of course I'm missing a reference! The problem is that even when one finds an example of the use, no one seems to mention what their "using" statement was to get that. System.Windows.Forms isn't the answer as it says Forms isn't in System.Windows. Is there any guidance on how to find the correct NuGet package to include? How to find the using statement? Even the Microsoft Documentation doesn't tell you what package it is in.
I want to have a web page open and set the directory to the folder on the server where the results are placed, and then select a result file or a log file and open it. If I hard code the path, the code works fine,
public void OnGet()
{
string directory = @"a directory";
using (OpenFileDialog openFileDialog = new OpenFileDialog() )
{
// the OpenFileDialog is underlined and says, no namespace, etc.
}
string logFile = String.Concat(directory, @"a file in the directory");
logContent.Append(String.Format(@"<h2>{0}</h2>", logFile));
...
OpenFileDialogis a WinForms (native Windows) class, this is not available on a web page.