publishing resource folder [modified]
-
Dear All. When I publish an application, there are 2 root folders created something like the first one
...\Apps\2.0\N2NJKNK\JHKJ7897KJ\**appl..tion**_ace7blkjnjn_0100.0000_534535
- where my app.exe file stored and the second one...\Apps\2.0\N2NJKNK\JHKJ7897KJ\**appl..exe**_ace7blkjnjn_0100.0000_768976
7 - where my resource files stored (some.exe, data.sdf) So to access to my resource (eg data.sdf) I have to do like that:"..\\appl..exe_ace7blkjnjn_0100.0000_7689767\\data.sdf
" The question: is there any proper way to get to that"...\**appl..exe**_..."
foldermodified on Friday, December 28, 2007 9:32:45 AM
-
Dear All. When I publish an application, there are 2 root folders created something like the first one
...\Apps\2.0\N2NJKNK\JHKJ7897KJ\**appl..tion**_ace7blkjnjn_0100.0000_534535
- where my app.exe file stored and the second one...\Apps\2.0\N2NJKNK\JHKJ7897KJ\**appl..exe**_ace7blkjnjn_0100.0000_768976
7 - where my resource files stored (some.exe, data.sdf) So to access to my resource (eg data.sdf) I have to do like that:"..\\appl..exe_ace7blkjnjn_0100.0000_7689767\\data.sdf
" The question: is there any proper way to get to that"...\**appl..exe**_..."
foldermodified on Friday, December 28, 2007 9:32:45 AM
The solution is to use Application.UserAppDataPath instead of Application.StartupPath
internal sealed partial class Settings { public Settings() { this.SettingsLoaded += new System.Configuration.SettingsLoadedEventHandler(Settings_SettingsLoaded); } void Settings_SettingsLoaded( object sender, System.Configuration.SettingsLoadedEventArgs e ) { String dataDirectory; if (( AppDomain.CurrentDomain.DomainManager != null ) && AppDomain.CurrentDomain.DomainManager.ToString().Contains("VSHost")) { dataDirectory = Application.StartupPath; } else { dataDirectory = **Application.UserAppDataPath**; } this["test1ConnectionString"] = Settings.Default.test1ConnectionString.Replace(".\\", dataDirectory + "\\");
} Thanks to http://blogs.msdn.com/smartclientdata/archive/2005/07/15/439008.aspx[^]