473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Executing directory Path?

bob
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
Jun 27 '08 #1
5 3221
Try..

string path =
Path.GetDirectoryName(Assembly.GetExecutingAssembl y().Location);

-Drew

"bob" <st**************@cutthis.adriley.co.nzwrote in message
news:5i********************************@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
Jun 27 '08 #2
bob

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 -
backwardswrote:
>Path.GetDirectoryName(Assembly.GetExecutingAssemb ly().Location);
Jun 27 '08 #3
On May 8, 3:07 pm, bob <startatbob_cl...@cutthis.adriley.co.nzwrote:
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 -

backwardswrote:
Path.GetDirectoryName(Assembly.GetExecutingAssembl y().Location);
this might be what you are looking for..I have not tried it myself..

Assembly.GetEntryAssembly().Location.
Jun 27 '08 #4
bob

Well Drew,
it worked.
Thank You
Bob

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

string path =
Path.GetDirectoryName(Assembly.GetExecutingAssemb ly().Location);

-Drew

"bob" <st**************@cutthis.adriley.co.nzwrote in message
news:5i********************************@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
Jun 27 '08 #5
bob

Hi Parez,
Thanks for your reply.
Drew's method worked.
Bob
On Thu, 8 May 2008 14:15:04 -0700 (PDT), parez <ps*****@gmail.com>
wrote:
>On May 8, 3:07 pm, bob <startatbob_cl...@cutthis.adriley.co.nzwrote:
>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 -

backwardswrote:
>Path.GetDirectoryName(Assembly.GetExecutingAssemb ly().Location);

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

Assembly.GetEntryAssembly().Location.
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jean-Marc Molina | last post by:
Hello, I can't find a way to execute a Windows application, whose directory path contains blank spaces, from a PHP script. I also wonder if the problem happens under Linux and other OS. ...
8
by: Darren Dale | last post by:
Is there a place to put python programs so I dont have to refer to the absolute path everytime I want to call them? For example: if I am in /home/me and want to execute: python...
13
by: Darren Dale | last post by:
Some time ago I asked about executing a python program or script. For windows, I was informed that the .py extension could be added to some list of executable extensions, and then I could just type...
0
by: Nick Coghlan | last post by:
Anyone playing with the CPython interpreter's new command line switch might have noticed that it only works with top-level modules (i.e. scripts that are directly on sys.path). If the script is...
15
by: Nick Coghlan | last post by:
Python 2.4's -m command line switch only works for modules directly on sys.path. Trying to use it with modules inside packages will fail with a "Module not found" error. This PEP aims to fix that...
15
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to...
0
by: Roshawn Dawson | last post by:
Hi, I have a web application that has various sub directories. Here is what it looks like: MyApp/default.aspx MyApp/Author/default.aspx MyApp/xslt/books.xsl
0
by: Rahul Chatterjee | last post by:
Hello All I have designed a dotnet application using VB which basically takes a selection and passes value to a crystal report which in turn passes the value to a Stored procedure. After the...
5
by: Benjamin | last post by:
How does one get the path to the file currently executing (not the cwd). Thank you
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.