Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Executing directory Path?

2 views
Skip to first unread message

bob

unread,
May 7, 2008, 10:14:02 PM5/7/08
to
Hi,
I have a DLL that uses the XMLReaderSettings class say mySettings.
I want to add mySchema.xsd to mySettings.Schemas.

As far as I can make out I need an absolute path to the mySchema.xsd
file.

Being inside a DLL, the only way I could see to get this was using the
Assembly.GetAssembly().Location method.

This worked fine on the development machine but on the production
machine the call was returning the root directory.

As a kludge I put mySchema. xsd in the root directory and away we
went.

Would appreciate any thoughts on how to fix this.

thanks
Bob

DrewCE

unread,
May 7, 2008, 11:15:16 PM5/7/08
to
Try..

string path =
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

-Drew

"bob" <startatb...@cutthis.adriley.co.nz> wrote in message
news:5in4245tcbunqkbe0...@4ax.com...

bob

unread,
May 8, 2008, 3:07:55 PM5/8/08
to

Hi Drew,
thanks for your reply.
I will try this as soon as the production machine becomes available.
But it seems to me that it will still fail as GetDirectoryName is
working on what is passed back by GetExecutingAssembly.Location

The problem is that GetExecutingAssembly.Location passes back a valid
location on the development machine and the root directory on the
production machine.
I will post the result.
thanks
Bob

On Wed, 7 May 2008 22:15:16 -0500, "DrewCE" <moc.sgodniahc@werd -
backwards> wrote:

>Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

parez

unread,
May 8, 2008, 5:15:04 PM5/8/08
to

this might be what you are looking for..I have not tried it myself..

Assembly.GetEntryAssembly().Location.

bob

unread,
May 8, 2008, 10:39:21 PM5/8/08
to

Well Drew,
it worked.
Thank You
Bob

On Wed, 7 May 2008 22:15:16 -0500, "DrewCE" <moc.sgodniahc@werd -
backwards> wrote:

bob

unread,
May 8, 2008, 10:40:38 PM5/8/08
to

Hi Parez,
Thanks for your reply.
Drew's method worked.
Bob
On Thu, 8 May 2008 14:15:04 -0700 (PDT), parez <psa...@gmail.com>
wrote:
0 new messages