2

I'm porting a .NET 4.6.1 console app to .NET Core.

I have NETStandard.Library 1.6 installed, and it's not letting me pass a file path string into a StreamReader constructor. Viewing the definition confirms that it's not available:

enter image description here

Where's it gone?

user888734
  • 3,797
  • 5
  • 36
  • 67
  • Change your .NET app to first open file stream and then pass it to StreamReader? – Evk Nov 19 '16 at 19:48
  • Thanks - I've done that, but I was also trying to get some insight into whether I have my configuration / dependencies set up wrong, or if this is intended. – user888734 Nov 19 '16 at 19:51
  • No your configuration is fine. It is not there in Core as you can see here: https://learn.microsoft.com/en-us/dotnet/core/api/system.io.streamreader – CodingYoshi Nov 19 '16 at 19:54

1 Answers1

3

This is correct. .Net Core 1.0/.Net Standard 1.x refactored the base libraries, so that basic stream types like StreamReader are in the System.IO package and FileStream is in the System.IO.FileSystem package. Since the constructor you're looking for would require StreamReader to depend on FileStream, it was removed.

Note that a large part of this refactoring was reversed for the upcoming .Net Core 2.0/.Net Standard 2.0, so you will be able to use this constructor on .Net Core in the future.

svick
  • 236,525
  • 50
  • 385
  • 514