relative XML file path
-
is it possible to give relative XML file path so that when a setup is installed on other machines,it fetches XML itself? private string m_strFileName = "account.xml"; it`s giving error thanks
Relative to what? When using the IO classes files are already relative to the application's - not the library in which your code runs - current working directory, not necessary the application's installation directory. You can get the current working directory by getting
Environment.CurrentDirectory
and the application's installation directory by gettingApplication.ExecutablePath
, passing that toDirectory.GetParent
. Depending on what installation technology you're using you can also get the exact path to any file regardless of what type it is. Since you didn't provide any details about what you're trying to do, however, it's impossible to help you. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog] -
is it possible to give relative XML file path so that when a setup is installed on other machines,it fetches XML itself? private string m_strFileName = "account.xml"; it`s giving error thanks
Hi! Try this: private string m_strFileName = ".\\account.xml"; ---------------------- Seeing the infinite...