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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top