PC Review


Reply
Thread Tools Rate Thread

Determining the Execution Folder of an Assembly

 
 
Phil Jones
Guest
Posts: n/a
 
      7th Jul 2004
How would I go about finding the path of the folder that an assembly is
executing within? Specifically I'm concerned with how to do this from any
type of app other than a WinForms or IIS app (like a Console or a
WindowsService). I can do this from WinForms or IIS - it's with the other
types of apps that I'm stumped.

Rather than rely on each particular application shell, is there some way to
determine this just by looking at the assembly.

Thanks everyone.
===
Phil
(Auckland | Aotearoa)


 
Reply With Quote
 
 
 
 
Sunny
Guest
Posts: n/a
 
      7th Jul 2004
Hi,

I'm using myAssembly.Location.

Sunny

In article <(E-Mail Removed)>,
(E-Mail Removed) says...
> How would I go about finding the path of the folder that an assembly is
> executing within? Specifically I'm concerned with how to do this from any
> type of app other than a WinForms or IIS app (like a Console or a
> WindowsService). I can do this from WinForms or IIS - it's with the other
> types of apps that I'm stumped.
>
> Rather than rely on each particular application shell, is there some way to
> determine this just by looking at the assembly.
>
> Thanks everyone.
> ===
> Phil
> (Auckland | Aotearoa)
>
>
>

 
Reply With Quote
 
Phil Jones
Guest
Posts: n/a
 
      8th Jul 2004
Ohhhhhhhh!!! Yeah that works. Not sure why I didn't find that.

Cheers Sunny - appreciate the pointer.
===
Phil




"Sunny" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I'm using myAssembly.Location.
>
> Sunny
>
> In article <(E-Mail Removed)>,
> (E-Mail Removed) says...
> > How would I go about finding the path of the folder that an assembly is
> > executing within? Specifically I'm concerned with how to do this from

any
> > type of app other than a WinForms or IIS app (like a Console or a
> > WindowsService). I can do this from WinForms or IIS - it's with the

other
> > types of apps that I'm stumped.
> >
> > Rather than rely on each particular application shell, is there some way

to
> > determine this just by looking at the assembly.
> >
> > Thanks everyone.
> > ===
> > Phil
> > (Auckland | Aotearoa)
> >
> >
> >



 
Reply With Quote
 
Peter Huang
Guest
Posts: n/a
 
      8th Jul 2004
Hi Phil,

I agree with Sunny's suggestion.
Did the code below work for you?
static void Main(string[] args)
{

Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().Location
.ToString());
}


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Phil Jones
Guest
Posts: n/a
 
      8th Jul 2004
Yes - that's all good. Thanks everyone!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining location of assembly programmatically kanepart2@hotmail.com Microsoft VB .NET 4 16th Aug 2007 12:36 PM
Determining assembly from namespace Ludwig Wittgenstein Microsoft Dot NET Framework 3 29th May 2006 04:46 PM
CF 1.0 assembly execution under CF 2.0 Olivier Dewit Microsoft Dot NET Compact Framework 2 6th Dec 2005 04:52 PM
Re: assembly execution path Mattias Sjögren Microsoft Dot NET 1 14th Apr 2005 09:28 PM
Execution permission cannot be acquired, when using Assembly.LoadFrom Thomas Jespersen Microsoft Dot NET Framework 2 17th Nov 2004 02:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:53 AM.