Add folder to project...

M

Marty

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
 
V

ViRi

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 ;)
 
M

Marty

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
 
S

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

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.
 
M

Marty

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
 
S

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

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.
 
M

Marty

Hi Stoitcho,

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

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

Top