Is there a way I can open and read a text file within a .NET project? I know I can use the System.IO.StreamReader class to do it for a Windows text file.
I’d like to store some SQL scripts for upgrading my database in text files within my project. Since I’m writing this in VB I can’t just paste the scripts directly into my code due to line continuations, where I could if it were C#. These are very long scripts.
Text files inside a project are not added to your executable. You can enable
Copy to Output Directoryin the properties for the .sql file. This will copy them alongside your assemblies to thebindirectory.From there, your program could read them like any other file.