problem publishing application

hi all

my program need a particular folder named "data", in which there are some important files....now....i publish my app and when i start it, it returns a directory not found exception...

how can i do to tell the application to go and consider this folder?i think that when publish is done in the new files created there isnt the "data" folder...how can i include this folder in the package?

tnx all

[451 byte] By [alecomo] at [2008-2-10]
# 1

the following code tests if the folder exists and creates it if it does not exist. Hope that is what you wanted:

string location = Assembly.GetExecutingAssembly().Location;

location = location.Substring(0, location.LastIndexOf("\\"));

if (!Directory.Exists(location + "\\data"))

Directory.CreateDirectory(location + "\\data");

else

MessageBox.Show("Folder exists!");

ralph

ralph. at 2007-9-10 > top of Msdn Tech,Feedback for forums and MSDN websites,Off-Topic Posts (Do Not Post Here)...
# 2

that's not my problem....

u know that there is the directory bin in which there is the executable...well in this directory i've put the folder data and in the code there are some lines:

//copio file default nella cartella selezionata
DirectoryInfo dir1 = new DirectoryInfo(@"c:\data");
DirectoryInfo dir2 = new DirectoryInfo(folderName);
AddDefaultFilesToWorkFolder(dir1,dir2,true);

now when i publish my app, in the new fles created there is no reference to the folder data!! for me this folder is too important!!!

i need that this folder must be a part of the new package created

please help

alecomo at 2007-9-10 > top of Msdn Tech,Feedback for forums and MSDN websites,Off-Topic Posts (Do Not Post Here)...
# 3

Are you making a msi package?
If yes go to the file systemeditor choose Application Folder and add a folder to it.

ralph

ralph. at 2007-9-10 > top of Msdn Tech,Feedback for forums and MSDN websites,Off-Topic Posts (Do Not Post Here)...