rated by 0 users
This post has 5 Replies | 1 Follower

Top 10 Contributor
Male
Posts 124
Md Nazmul Ahsan Posted: 10-03-2009 4:15 PM

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 Ahsan
Programmer (.NET Framework)
CIS, IADCS & DIT

Top 10 Contributor
Male
Posts 138

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 Ferdous
Project Manager, Congral LLC
Technical Author, DevMedia, Brazil

Top 10 Contributor
Male
Posts 124

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

"Excuse if any gaffe."

Md Nazmul Ahsan
Programmer (.NET Framework)
CIS, IADCS & DIT

Top 10 Contributor
Male
Posts 138

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

 

 

MJ Ferdous
Project Manager, Congral LLC
Technical Author, DevMedia, Brazil

Top 10 Contributor
Male
Posts 124

Hi Ferdous vi,

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

Copy to Output Dir: Copy Always/ If Newer

Solution Properties > Publish (Tab) > Application Files > Publish Status : Include

 

XML file is count as data file in WPF application.

Thanks

"Excuse if any gaffe."

Md Nazmul Ahsan
Programmer (.NET Framework)
CIS, IADCS & DIT

Top 10 Contributor
Male
Posts 138

Great!! Thanks.

MJ Ferdous
Project Manager, Congral LLC
Technical Author, DevMedia, Brazil

Page 1 of 1 (6 items) | RSS