tags:

views:

15

answers:

1

Hi,

So when debugging simply getting the executing path and accessing files in reference to that works fine, e.g.

string applicationDirectory = System.IO.Directory.GetCurrentDirectory();

or One of the many other ways of getting the directory. It gets the directory with the WPF app in it and I can work with that fine.

However, once I publish the application it no longer works, instead the variable is something like this: Documents and Settings\ ... \Apps\2.0\MHERCHY1.BJ7\O0LQQBXT.1GH\wpfc..xbap_98594a552e5855fe_0001.0000_2df2d386a082f2f3

Which is not where it is installed (but I'm guessing where it is executing from).

So how do I do this? I need a way of pointing to the data resources for the application. Thanks!

+1  A: 

USe Assembly.GetEntryAssembly().Location

it will give you the path of your executable.

saurabh