Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

Assembly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeffrey - 26 Jul 2005 06:41 GMT
hello,

how do i get an assembly for a process which is not the own process.
and i also do not want to load a new assembly.

please no answers with Load, LoadFrom or GetExecutingAssembly.

jeff
Jon Skeet [C# MVP] - 26 Jul 2005 06:53 GMT
> how do i get an assembly for a process which is not the own process.
> and i also do not want to load a new assembly.
>
> please no answers with Load, LoadFrom or GetExecutingAssembly.

Sorry, it's not very clear what you mean. What do you actually want to
do? What do you mean by "get an assembly"? Do you mean you want to know
which assemblies have been loaded into a process?

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jeffrey - 26 Jul 2005 22:23 GMT
yes, i want to know which assemblies have been loaded into a process.
then i will get the instances of the assemblies.

a example. please don't care about the processid . the processid is not
the problem, i want the assemblies for a process given by processid and
i am looking how to write the function GetAssemblyfromPID(pid).

//pid =ProcessID
Assembly[] asm = GetAssemblyfromPID(pid)
Jon Skeet [C# MVP] - 27 Jul 2005 06:49 GMT
> yes, i want to know which assemblies have been loaded into a process.
> then i will get the instances of the assemblies.

Right. At least the problem is clear now - unfortunately, I don't know
the answer. I don't believe there's a .NET way of doing it - you'll
need to use interop, I suspect, to find out which DLLs have been
loaded, and then find out which of those DLLs are .NET assemblies.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jeffrey Murdock - 27 Jul 2005 18:37 GMT
thx

Jeff
erick@csharpbox.com - 28 Jul 2005 11:36 GMT
If you want to know which assemblies are loaded in a certain process you
can just get the Modules from the Process by getting a handle of the process
itself.

System.Diagnostics.Process[] Processes =  System.Diagnostics.Process.GetProcesses();
System.Diagnostics.Process aspnetProcess = null;
foreach(System.Diagnostics.Process process in Processes )
{
    if(process.ProcessName.Equals("aspnet_wp"))
    {
        aspnetProcess = process;
        break;
    }
}
foreach(System.Diagnostics.ProcessModule module in aspnetProcess.Modules )
{
         System.Diagnostics.Debug.WriteLine(module.FileName);
}

After that you have the path, so you can do whatever you want with them.
If you dont want to load them into the current appdomain you will have to
use AssemblyName.GetAssemblyName(...). But if it fails, it is not a .NET
assembly. There are more elegant ways of doing that but i am not sure what
you are working on.

Erick Sgarbi

> thx
>
> Jeff

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.