save file to bin directory

  • Thread starter Thread starter microsoft.news.com
  • Start date Start date
M

microsoft.news.com

I have a console app that creates a file and I want to save it to the bin
directory of the project. How can I have the file save there as default?

My code looks like this:

fileName.SaveAs("testfile.txt");


it's going to document settings -- my documents and saving it there. I need
to save it in the bin folder of the project so my printing process can pick
it up and print it.
 
You need to specify the full path rather than the short name... assuming
that your exe is already running from the bin folder, you can get the
location parsing
System.Reflection.Assembly.GetExecutingAssembly().Location()

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
Back
Top