save file to bin directory

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • microsoft.news.com

    #1

    save file to bin directory

    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.



  • Carlos J. Quintero [.NET MVP]

    #2
    Re: save file to bin directory

    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.Reflecti on.Assembly.Get ExecutingAssemb ly().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:
    MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.


    "microsoft.news .com" <CSharpCoder> escribió en el mensaje
    news:uiOpOD6XFH A.1384@TK2MSFTN GP09.phx.gbl...[color=blue]
    >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.
    >
    >
    >[/color]


    Comment

    Working...