none
.NET Core and FileStream RRS feed

  • Question

  • With the advent of .NET Core / Native console app (RC1) I wonder if there is an equivalent of FileStream in  .NET Core that I can use to open any location on the disk?

    I just tried to compile

    using (var s = new FileStream(@"c:\temp\a.txt", FileMode.Create))
    using (var sw = new StreamWriter(s))
        sw.WriteLine("it worked!");
    


    And I got the following erros

    Program.cs(13,32,13,42): DNX Core 5.0 error CS0246: The type or namespace name 'FileStream' could not be found (are you missing a using directive or an assembly reference?)
    Program.cs(13,61,13,69): DNX Core 5.0 error CS0103: The name 'FileMode' does not exist in the current context

    And YES I have 'using System.IO'
    The problem is in the library, it's NOT mscorlib, it's .NET Core

    Monday, February 15, 2016 1:02 AM

Answers

  • Someone gave me the answer, I must install this .NET package

    https://www.nuget.org/packages/System.IO.FileSystem/4.0.0

    • Marked as answer by Lloyd Monday, February 15, 2016 5:59 AM
    Monday, February 15, 2016 5:59 AM

All replies

  • Someone gave me the answer, I must install this .NET package

    https://www.nuget.org/packages/System.IO.FileSystem/4.0.0

    • Marked as answer by Lloyd Monday, February 15, 2016 5:59 AM
    Monday, February 15, 2016 5:59 AM
  • @LIoyd,

    Glad to hear you have worked it out, and thanks for sharing here.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 15, 2016 10:15 AM