daek
daek

Reputation: 13

NotSupportedException Error for getcurrentDirectory()

I'm using VS 2008 on a Windows 8 laptop and get a NotSupportedException when the debugger hits this line of code System.IO.Directory.GetCurrentDirectory(). Could anyone tell me why am I getting this error?

error image

Upvotes: 0

Views: 669

Answers (2)

Ondrej Janacek
Ondrej Janacek

Reputation: 12616

Based on the documentation there are only two situation in which you can get this exception.

  • The operating system is Windows CE, which does not have current directory functionality.
  • This method is available in the .NET Compact Framework, but is not currently supported.

Windows 8 is not Windows CE, so I guess you have installed .NET Compact Framework.

Upvotes: 2

panpernicek
panpernicek

Reputation: 676

I recommend to use System.Reflection.Assembly.GetExecutingAssembly.Location

   string startuppath = IO.Path.GetFolderName(System.Reflection.Assembly.GetExecutingAssembly.Location);

Upvotes: -1

Related Questions