0

I have a dataset file a.txt where I want to include as part of the visual studio 2010 C# project. Where should I put it(need your suggestion), and how should I read it with FileInfo (as project might move around the PC by different developers, it is not good to have hardcoded path)?

william007
  • 17,375
  • 25
  • 118
  • 194

1 Answers1

1

You could put it in /resources or some dir you create from root. Then you can read it at runtime from

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)) + "\\resources" 

or you can embed is a resource, then you can use

Assembly.GetManifestResourceStream(string)

more info on that here How to embed a text file in a .NET assembly?

Community
  • 1
  • 1
Orn Kristjansson
  • 3,435
  • 4
  • 26
  • 40