Problem with deployment of windows application using setup wizard.

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-05-20T11:46:54Z Indexed on 2010/05/20 11:50 UTC
Read the original article Hit count: 180

Filed under:
|

I have some xml files, which are used in my application. They are stored in the same folder with application , in subfolder DATA: "C:\MyProject\DATA\". To get the DATA folder path i use this code :

 static public string GetDataFolderPath()
 {
      string s = System.IO.Directory.GetCurrentDirectory().Replace(@"\bin\Debug", ""); 
      int i = s.LastIndexOf(@"\");
      s = s.Substring(0, i);
      i = s.LastIndexOf(@"\");
      s= s.Substring(0, i);
      return s + @"\Data\"; 
 }

So when i want to deploy my application, i create a setup project, and add the DATA folder to Application folder. But after i install the program f.e. "C:\Project"(DATA folder- "C:\Project\DATA" i got the error: "folder C:\DATA is not found". What i need to change to make things working after deployment. Why it looks for the DATA folder on 1 level higher?

© Stack Overflow or respective owner

Related posts about winforms

Related posts about c#