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

Re: Executing directory Path? by DrewCE

DrewCE
Wed May 07 22:15:16 CDT 2008

Try..

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

-Drew

"bob" <startatbob_clegg@cutthis.adriley.co.nz> wrote in message
news:5in4245tcbunqkbe07tlm3hd2lpe0aoi4q@4ax.com...
> 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


Re: Executing directory Path? by bob

bob
Thu May 08 14:07:55 CDT 2008


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);

Re: Executing directory Path? by parez

parez
Thu May 08 16:15:04 CDT 2008

On May 8, 3:07 pm, bob <startatbob_cl...@cutthis.adriley.co.nz> wrote:
> 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);

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

Assembly.GetEntryAssembly().Location.

Re: Executing directory Path? by bob

bob
Thu May 08 21:39:21 CDT 2008


Well Drew,
it worked.
Thank You
Bob

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

>Try..
>
> string path =
>Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
>
>-Drew
>
>"bob" <startatbob_clegg@cutthis.adriley.co.nz> wrote in message
>news:5in4245tcbunqkbe07tlm3hd2lpe0aoi4q@4ax.com...
>> 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

Re: Executing directory Path? by bob

bob
Thu May 08 21:40:38 CDT 2008


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

>On May 8, 3:07 pm, bob <startatbob_cl...@cutthis.adriley.co.nz> wrote:
>> 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);
>
>this might be what you are looking for..I have not tried it myself..
>
>Assembly.GetEntryAssembly().Location.