.NET

Reply
Valued Contributor
MRiemenCAD
Posts: 65
Registered: ‎03-31-2003
Message 1 of 4 (335 Views)
Accepted Solution

Collection of loaded .Net applications

335 Views, 3 Replies
08-28-2012 09:21 AM

Is there a collection object where I can iterate through loaded .net applications? Also, is there a programatic way to load .net apps from within another application? I would Like to use the registry to auto-load an initial app that then manages and loads other .net toolsets. 

 

Thanks for any help in advance.

Hi,

 

You can get the loaded .NET assemblies with the code below:

 

>>>

[CommandMethod("ListLoadedApplication")]

public void CmdListLoadedAssemblies()

{

  Document doc = Application.DocumentManager.MdiActiveDocument;

  Editor ed = doc.Editor;

 

  //get all loaded assemblies in the current appdomain

  System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies();

  foreach (System.Reflection.Assembly assembly in assemblies)

  {

    //let's remove built-in .NET assemblies

    if (!assembly.Location.ToLower().Contains("windows"))

    {

      ed.WriteMessage(assembly.Location + "\n");

    }

  }

}

<<<

 

Regards,

 

*Expert Elite*
norman.yuan
Posts: 1,045
Registered: ‎04-27-2009
Message 2 of 4 (320 Views)

Re: Collection of loaded .Net applications

08-28-2012 12:08 PM in reply to: MRiemenCAD

You can load .NET DLL into AutoCAD with Syste,ReflectionAssembly.Load()/LoadFrom(). It does the same thing just as you load them by NETLOAD command in AutoCAD.

ADN Support Specialist
augusto.goncalves
Posts: 387
Registered: ‎04-30-2009
Message 3 of 4 (277 Views)

Re: Collection of loaded .Net applications

08-30-2012 07:41 AM in reply to: MRiemenCAD

Hi,

 

You can get the loaded .NET assemblies with the code below:

 

>>>

[CommandMethod("ListLoadedApplication")]

public void CmdListLoadedAssemblies()

{

  Document doc = Application.DocumentManager.MdiActiveDocument;

  Editor ed = doc.Editor;

 

  //get all loaded assemblies in the current appdomain

  System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies();

  foreach (System.Reflection.Assembly assembly in assemblies)

  {

    //let's remove built-in .NET assemblies

    if (!assembly.Location.ToLower().Contains("windows"))

    {

      ed.WriteMessage(assembly.Location + "\n");

    }

  }

}

<<<

 

Regards,

 

Regards,



Augusto Goncalves
Autodesk Developer Network
Valued Contributor
MRiemenCAD
Posts: 65
Registered: ‎03-31-2003
Message 4 of 4 (272 Views)

Re: Collection of loaded .Net applications

08-30-2012 07:43 AM in reply to: augusto.goncalves

Thanks for posting. I appreciate your help.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!