P
P_Prdn
I was wondering if somebody could show me on how to use relative path in
windows application that will work during DEVELOPMENT as well as after
DEPLOYMENT. In short, here's my situation. During development the files in my
project are located as follows:
MyProject\bin\Release\MyApplication.exe
MyProject\Settings\MyXMLFile.xml
During development I use this syntax to load to MyXMLFile.xml from the .exe:
xmlDocument.Load(@"..\..\Settings\MyXMLFile.xml");
Everything was fine until after I deployed the project whereas the file
location now changed to:
C:\Program Files\MyProject\MyApplication.exe
C:\Program Files\MyProject\Settings\MyXMLFile.xml
Now I started to get an error message stating that file
'C:\Settings\MyXMLFile.xml doesn't exist'.
Please keep in mind these limitations:
1. I do not want to hard-code the relative path in app.config, I just want
to use relative path.
2. I cannot use resource file because I need to change the MyXMLFile.xml
during runtime.
3. Basically what I need is the relative path that can point to the project
folder instead of the .exe, much like ~ sign to point to application root
folder in web application.
Thanks,
P_Prdn
windows application that will work during DEVELOPMENT as well as after
DEPLOYMENT. In short, here's my situation. During development the files in my
project are located as follows:
MyProject\bin\Release\MyApplication.exe
MyProject\Settings\MyXMLFile.xml
During development I use this syntax to load to MyXMLFile.xml from the .exe:
xmlDocument.Load(@"..\..\Settings\MyXMLFile.xml");
Everything was fine until after I deployed the project whereas the file
location now changed to:
C:\Program Files\MyProject\MyApplication.exe
C:\Program Files\MyProject\Settings\MyXMLFile.xml
Now I started to get an error message stating that file
'C:\Settings\MyXMLFile.xml doesn't exist'.
Please keep in mind these limitations:
1. I do not want to hard-code the relative path in app.config, I just want
to use relative path.
2. I cannot use resource file because I need to change the MyXMLFile.xml
during runtime.
3. Basically what I need is the relative path that can point to the project
folder instead of the .exe, much like ~ sign to point to application root
folder in web application.
Thanks,
P_Prdn