Hi,
I am working a WPF application several months. Now I am going to deploy that application. During test deployment, I am facing a file path problem. I describe the scenario below:
I have an appConfig.xml file that contains application different settings, which I need to changes many times after publish. Now I add that file to my project and changes it properties > build Action to Content, also changes Copy to Output Directory > Copy Always.
I am using AppDomain.CurrentDomain.BaseDirectory for get the file path. It is working fine in development PC. But it does not work after publish. File is not found that location. Any help is appreciated.
Any help is appreciated.
"Excuse if any gaffe."Md Nazmul AhsanProgrammer (.NET Framework)CIS, IADCS & DIT
Use this to solve you problem:
string AppConfigPath= "appConfig.xml";
string dbPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AppConfigPath);
Hope this will help
MJ FerdousProject Manager, Congral LLCTechnical Author, DevMedia, Brazil
Hi Ferdous vi,
Thanks for reply. Currnetly I'm using same code for get path. It works fine before deploy but it does not work after deploy. I have problem in deployment. File is not send to secpific location.
Thanks
It works for me:
Try First in the debug mode then in the release mode
Build Action: None
Copy to Output Dir: Copy Always/ If Newer
I have done the same thing you have said, which I was already describe in my first post. Anywaz thanks I solve the problem.
Build Action: Content
Solution Properties > Publish (Tab) > Application Files > Publish Status : Include
XML file is count as data file in WPF application.
Great!! Thanks.