C#C
C#3y ago
27 replies
Marvin

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)'


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);
                }
            }
        }
Was this page helpful?