.NET

Reply
Valued Contributor
RamanSBV
Posts: 86
Registered: ‎02-28-2012
Message 1 of 6 (782 Views)

Can I Netload 4.5 dll into autocad 2012

782 Views, 5 Replies
09-10-2012 11:38 PM

Hi,

 

 

Please guide me, weither i can use .net 4.5 dll on autocad 2012.

 

Regards,

Raman

*Expert Elite*
norman.yuan
Posts: 965
Registered: ‎04-27-2009
Message 2 of 6 (748 Views)

Re: Can I Netload 4.5 dll into autocad 2012

09-12-2012 09:54 AM in reply to: RamanSBV

Have you give it a try?

 

Here is what I tried with my Acad2012 and VS2012 (C# or VB.NET, should not matter):

 

1. Created a DLL project against .NET4.5, added reference to Acad2012's acdbmgd.dll/acmgd.dll; Set debugging to start Acad.exe

2. wrote some simple acad code in a command method, like

    Editor.WriteMessage("\nHello World!");

    LayoutManager.Current.CurrentLayout="Layout1";

    Also some simple code in IExtensionApplication.Initialize(), such as Editor.WriteMessage(.....);

3. Start debugging. Then I got exception...

4. Go to VS2012->Menu->Degub->Exceptions..., in "Managed Debugging Assistants", uncheck "Thrown" on item "LoaderLock". Click OK. Start debugging again.

5. In Acad2012, netload the .NET4.5 dLL. the code in IExtensionApplication.Initialize() runs OK, because the command line shows the message.

6. Issue the command, the layout "Layout1" is then set to current correctly.

 

That is, at least, .NET4.5 code can run in Acad2012 configured to use .NET4.0 (i.e. in acad.exe.config, there is default item <supportedRuntime version="v4.0"/> in the <startup /> section. However, if I change "v4.0" to "v4.5", AutoCAD 2012 startup crashes. If I comment out <supportedRuntime...> (so that acad2012 uses .NET2/3.5 by default), then NETLOADing .NET4.5 dll will cause exception.

 

With all siad, my test was very limited. simple code running may not mean one does not get problem from more complicated development. More importantly, if any problem emerges, I am sure Autodesk would not provide support on this. So, unless my development must use something only available with .NET 4.5 and I am willing to take the risk, there is no point to try my luck with acad2012+.NET4.5. So far .NET4.0 is good enough.

Mentor
khoa.ho
Posts: 159
Registered: ‎09-15-2011
Message 3 of 6 (729 Views)

Re: Can I Netload 4.5 dll into autocad 2012

09-12-2012 09:23 PM in reply to: RamanSBV

I did a quick test with Visual Studio 2012 to create a class project using .NET 4.5, reference AutoCAD 2013 DLL files, and it WORKS!

 

It is very interesting that we can use the latest VS and .NET 4.5 to build plug-ins for AutoCAD 2013. I don't know if it will work with AutoCAD 2012 or not.

 

See the attachment for the sample project (requires VS 2012 and A2013).

 

-Khoa

Distinguished Contributor
fxcastil
Posts: 404
Registered: ‎11-11-2002
Message 4 of 6 (711 Views)

Re: Can I Netload 4.5 dll into autocad 2012

09-13-2012 09:15 AM in reply to: RamanSBV

 

Which Edition of Microsoft Visual Studio to Use

Microsoft Visual Studio is available in multiple versions and editions. To use the .NET API for AutoCAD 2012, you need to use:

  • Microsoft Visual Studio 2010
  • Microsoft .NET Framework 4.0

http://exchange.autodesk.com/autocadarchitecture/enu/online-help/ARCHDESK/2012/ENU/pages/WS73099cc14...

Valued Contributor
RamanSBV
Posts: 86
Registered: ‎02-28-2012
Message 5 of 6 (689 Views)

Re: Can I Netload 4.5 dll into autocad 2012

09-13-2012 11:04 PM in reply to: fxcastil

Hi,

 

I am using Microsoft Visual Studio 2010. With .Net Framework 4.5

 

app.Config :

<?xmlversion="1.0"?>

<configuration>

    <startup>

    <supportedRuntimeversion="v4.0"

    sku=".NETFramework,Version=v4.5"/>

    </startup>

</configuration>

 

Regards,

Raman

*Expert Elite*
norman.yuan
Posts: 965
Registered: ‎04-27-2009
Message 6 of 6 (679 Views)

Re: Can I Netload 4.5 dll into autocad 2012

09-14-2012 06:24 AM in reply to: RamanSBV

RamanSBV wrote:

Hi,

 

I am using Microsoft Visual Studio 2010. With .Net Framework 4.5

 

app.Config :

<?xmlversion="1.0"?>

<configuration>

    <startup>

    <supportedRuntimeversion="v4.0"

    sku=".NETFramework,Version=v4.5"/>

    </startup>

</configuration>

 

Regards,

Raman


You are kidding, aren't you? How could you use VS2010 with .NET4.5?

 

Do you write code in VS2010 and then manually use .NET4.5 comiler to compile the code into DLL? Why not use VS2012?

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community