471,318 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

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
Dec 6 '05 #1
6 5712
you can get the folder of where the mail executable is runned from with
this: System.Windows.Forms.Application.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 ;)

Dec 6 '05 #2
Hi Viri,
thank you, I already use the "StartupPath", 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\release".

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:
you can get the folder of where the mail executable is runned from with
this: System.Windows.Forms.Application.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 ;)

Dec 6 '05 #3
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)myFolder"
copy"$(ProjectDir)*.*"$(TargetDir)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" <xm******@hotmail.com> wrote in message
news:l9llf.234949$ir4.204910@edtnps90...
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

Dec 6 '05 #4
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:
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)myFolder"
copy"$(ProjectDir)*.*"$(TargetDir)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.

Dec 6 '05 #5
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" <xm******@hotmail.com> wrote in message
news:i7mlf.234960$ir4.120328@edtnps90...
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:
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)myFolder"
copy"$(ProjectDir)*.*"$(TargetDir)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.


Dec 7 '05 #6
Hi Stoitcho,

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

Stoitcho Goutsev (100) [C# MVP] wrote:
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.

Dec 7 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Vagif Abilov | last post: by
5 posts views Thread by astroboy | last post: by
2 posts views Thread by cashdeskmac | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.