none
DriveInfo does not exist in the namespace System.IO RRS feed

  • Question

  • When attempting to execute the following:

    System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();

    I get this error: Error CS0234 The type or namespace name 'DriveInfo' does not exist in the namespace 'System.IO' (are you missing an assembly reference?).

    I have the

    using System.IO;

    directive, but DriveInfo just doesn't seem to exist.

    Why, and any suggestions?

    Saturday, December 24, 2016 1:19 AM

All replies

  • It works in case of Windows Forms and other kinds of applications. What type of applications are you creating? Maybe there are restrictions and some alternative approaches.

    Saturday, December 24, 2016 11:28 AM
  • Hi capricorn62,

    I wonder if you are developing Window Store Apps.

    Not every class in System.IO is supported for Windows Store Apps.

    Here is the list of supported classes.

    Here is a list of all of the classes in System.IO with supported ones marked in the first column with a suitcase icon.

    Best regards,

    Kristin


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 26, 2016 2:35 AM