Add folder to project...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marty

    Add folder to project...

    Hi,

    I want to add a folder (named myFolder) to my project and fill it with
    files and want it to appear under "../projectFolder/bin/debug/myFolder"
    and "../projectFolder/bin/release/myFolder". I want my program to
    access files within "myFolder".

    What is the procedure in the IDE to do that? The only location I got
    was "../projectFolder/bin/myFolder" doing "add folder" from the project.

    Thank you :)
    Marty
  • ViRi

    #2
    Re: Add folder to project...

    you can get the folder of where the mail executable is runned from with
    this: System.Windows. Forms.Applicati on.StartupPath, this will return a
    string to the current folder ("../projectFolder/bin/debug/") without
    the trailing '/', so remember to append it befor adding new
    folders/files to it ;)

    Comment

    • Marty

      #3
      Re: Add folder to project...

      Hi Viri,
      thank you, I already use the "StartupPat h", very usefull. I think my
      request lack of a specific detail, I'll tell you. I save my project in
      a sourceSafe database, and I want that anybody who open the project from
      the VSS DB get immediately the set of folder and file (\myfolder\*.*) to
      its local project directory under "bin\debug" or "bin\releas e".

      So I thaught that I should create the folder "myFolder" from the project
      in the solution explorer.

      Am I right? I hope I am more clear :)

      Thank you!
      Marty

      ViRi wrote:[color=blue]
      > you can get the folder of where the mail executable is runned from with
      > this: System.Windows. Forms.Applicati on.StartupPath, this will return a
      > string to the current folder ("../projectFolder/bin/debug/") without
      > the trailing '/', so remember to append it befor adding new
      > folders/files to it ;)
      >[/color]

      Comment

      • Stoitcho Goutsev \(100\) [C# MVP]

        #4
        Re: Add folder to project...

        Marty,

        I understand you want to do this in the IDE e.g. upon running project from
        the IDE (F5 or Ctrl+F5 ) myFolder to be created in the correct output
        folder.

        What I'd do in this case is I'm going to create myFolder in the project
        folder (along with the rest of the source files) then I'm going to add a
        post-build event that is going to be like

        md "$(TargetDir)my Folder"
        copy"$(ProjectD ir)*.*"$(Target Dir)myFolder"

        VS creates *bat* file out of the code for the build events so you can use
        any command prompt command there.

        To add post-build event in VS2003 for C# open the project propeties and find
        "Build Events" settings under the "Common Properties" sections.

        I hope that you use C# because in VS2003 VB don't support build events. As a
        matter if fact if you add the post-build event directly in the vb project
        file it will execute it, but next time you do something on the project
        settings in the IDE the build event will be removed.

        In VS2005 both VB and C# support build events.


        --
        HTH
        Stoitcho Goutsev (100) [C# MVP]

        "Marty" <xmarty99@hotma il.com> wrote in message
        news:l9llf.2349 49$ir4.204910@e dtnps90...[color=blue]
        > Hi,
        >
        > I want to add a folder (named myFolder) to my project and fill it with
        > files and want it to appear under "../projectFolder/bin/debug/myFolder"
        > and "../projectFolder/bin/release/myFolder". I want my program to access
        > files within "myFolder".
        >
        > What is the procedure in the IDE to do that? The only location I got was
        > "../projectFolder/bin/myFolder" doing "add folder" from the project.
        >
        > Thank you :)
        > Marty[/color]


        Comment

        • Marty

          #5
          Re: Add folder to project...

          Hi Stoitcho,

          That sound very interesting, I'll try it.

          Does the post-build event content is handled when we make a deployment
          project? Does all myFolder content will be treated looking like
          dependencies?

          Thank you very much!
          Marty



          Stoitcho Goutsev (100) [C# MVP] wrote:[color=blue]
          > Marty,
          >
          > I understand you want to do this in the IDE e.g. upon running project from
          > the IDE (F5 or Ctrl+F5 ) myFolder to be created in the correct output
          > folder.
          >
          > What I'd do in this case is I'm going to create myFolder in the project
          > folder (along with the rest of the source files) then I'm going to add a
          > post-build event that is going to be like
          >
          > md "$(TargetDir)my Folder"
          > copy"$(ProjectD ir)*.*"$(Target Dir)myFolder"
          >
          > VS creates *bat* file out of the code for the build events so you can use
          > any command prompt command there.
          >
          > To add post-build event in VS2003 for C# open the project propeties and find
          > "Build Events" settings under the "Common Properties" sections.
          >
          > I hope that you use C# because in VS2003 VB don't support build events. As a
          > matter if fact if you add the post-build event directly in the vb project
          > file it will execute it, but next time you do something on the project
          > settings in the IDE the build event will be removed.
          >
          > In VS2005 both VB and C# support build events.
          >
          >[/color]

          Comment

          • Stoitcho Goutsev \(100\) [C# MVP]

            #6
            Re: Add folder to project...

            Marty,

            There are two build events - pre-build and post-build they are executed
            before executing build and after executing the build operation. For the
            postbuild there are couple of conditions - every time or only on succesful
            build. It is simple execution of a *bat* file the files are not treated as
            dependencies. If you want to more special processing during deployment you
            should consider creating installation package.


            --

            Stoitcho Goutsev (100) [C# MVP]

            "Marty" <xmarty99@hotma il.com> wrote in message
            news:i7mlf.2349 60$ir4.120328@e dtnps90...[color=blue]
            > Hi Stoitcho,
            >
            > That sound very interesting, I'll try it.
            >
            > Does the post-build event content is handled when we make a deployment
            > project? Does all myFolder content will be treated looking like
            > dependencies?
            >
            > Thank you very much!
            > Marty
            >
            >
            >
            > Stoitcho Goutsev (100) [C# MVP] wrote:[color=green]
            >> Marty,
            >>
            >> I understand you want to do this in the IDE e.g. upon running project
            >> from the IDE (F5 or Ctrl+F5 ) myFolder to be created in the correct
            >> output folder.
            >>
            >> What I'd do in this case is I'm going to create myFolder in the project
            >> folder (along with the rest of the source files) then I'm going to add a
            >> post-build event that is going to be like
            >>
            >> md "$(TargetDir)my Folder"
            >> copy"$(ProjectD ir)*.*"$(Target Dir)myFolder"
            >>
            >> VS creates *bat* file out of the code for the build events so you can use
            >> any command prompt command there.
            >>
            >> To add post-build event in VS2003 for C# open the project propeties and
            >> find "Build Events" settings under the "Common Properties" sections.
            >>
            >> I hope that you use C# because in VS2003 VB don't support build events.
            >> As a matter if fact if you add the post-build event directly in the vb
            >> project file it will execute it, but next time you do something on the
            >> project settings in the IDE the build event will be removed.
            >>
            >> In VS2005 both VB and C# support build events.
            >>[/color][/color]

            Comment

            • Marty

              #7
              Re: Add folder to project...

              Hi Stoitcho,

              thank you for your detailed explanation, now I understand the mecanism :)
              Marty

              Stoitcho Goutsev (100) [C# MVP] wrote:[color=blue]
              > Marty,
              >
              > There are two build events - pre-build and post-build they are executed
              > before executing build and after executing the build operation. For the
              > postbuild there are couple of conditions - every time or only on succesful
              > build. It is simple execution of a *bat* file the files are not treated as
              > dependencies. If you want to more special processing during deployment you
              > should consider creating installation package.
              >
              >[/color]

              Comment

              Working...