Marvin
Marvin
CC#
Created by Marvin on 4/15/2023 in #help
Issue with FolderBrowserDialog in console application
Hey, when I start my application via Visual Studio everything works, but as soon as I start the console application directly, I get the following error:
System.MissingMethodException: Method not found: 'Void System.Security.Permissions.RegistryPermission..ctor(System.Security.Permissions.PermissionState)'
System.MissingMethodException: Method not found: 'Void System.Security.Permissions.RegistryPermission..ctor(System.Security.Permissions.PermissionState)'
Code:
public static void OpenFileDialog()
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.ShowNewFolderButton = true;
if (fbd.ShowDialog() == DialogResult.OK)
{
foreach (var path in Directory.GetFiles(fbd.SelectedPath))
{
Console.WriteLine(path);
}
}
}
public static void OpenFileDialog()
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.ShowNewFolderButton = true;
if (fbd.ShowDialog() == DialogResult.OK)
{
foreach (var path in Directory.GetFiles(fbd.SelectedPath))
{
Console.WriteLine(path);
}
}
}
28 replies