.NET

.NET

Reply
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 1 of 18 (617 Views)
Accepted Solution

Debug using Visual Studio Express 2013 and AutoCad 2010/2014

617 Views, 17 Replies
03-14-2014 12:36 AM

Hi, 

 

With Visual Studio Express 2013 i'm trying to debug AutoCad2010, but it refuses to break the operation, Is it possible to debug AutoCad 2010 with VSE2013? I am using framework 3.5, because AutoCad 2010 doesn't work with 4.5

 

I have created multiple projects in VSE2008 with AutoCad 2010. That worked fine..

 

kind regards, 

 

Wouter

*Expert Elite*
Alfred.NESWADBA
Posts: 8,982
Registered: ‎06-29-2007
Message 2 of 18 (598 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 02:50 AM in reply to: wbdehaan

Hi,

 

>> i'm trying to debug AutoCad2010, but it refuses to break the operation

How does that "break the operation" look like? Do you get any messages or what happens?

At least yes, the combination of VS2013 Prof. and debug AutoCAD 2010 works well, and so I guess that the Express version does work too.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 3 of 18 (587 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 03:39 AM in reply to: wbdehaan

Hi Alfred,

 

thank you for your reply!

 

I will try to explain what i did. first I created a new project, added acdbmgd.dll and acmgd.dll, (with properties copy local: false)

then changed the testproject.vbproj file, and added 2 lines, because this option is not available in the Express edition to start AutoCad:

 

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files (x86)\AutoCAD 2010\acad.exe</StartProgram>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <DocumentationFile>testproject.xml</DocumentationFile>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>

 

then added some simple code in class1.vb

 

Imports Autodesk.AutoCAD.Runtime

Public Module testModule
    <CommandMethod("testprog")> Sub main()

        Dim TempText As String = "Hello World"
        MsgBox(TempText)

    End Sub
End Module

- pressed 'Start- '-button in VBE: with options on the right of start-button: Debug & Any CPU

- after that AutoCad started automatically, 

- in AutoCad I typed netload, and loaded the dll from the \bin\debug\testproject.dll

- when I type 'testprog' in the command-line of AutoCad, the program is started, and gives me 'hello World'-msgbox.

 

but when I press 'Pause'-button in VBE2013, to debug my code, I get this message:

 

 

error.png

 

 

I tried the option: use managed compatibility mode in Tools > Options

debug.png

 

and also Enable native code debugging, but it doesn't work

 

debug2.png

 

I Use a 64bit machine with Windows 7, Visual Studio Express 2013, and AutoCad 2010* and AutoCad2014

(* My collegues use AutoCad2010, because I have to rewrite tons of VBA-code)

 

Hope I explained enough, awaiting your answer,

 

kind regards, 

 

Wouter de Haan

the Netherlands

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 8,982
Registered: ‎06-29-2007
Message 4 of 18 (580 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 04:08 AM in reply to: wbdehaan

Hi,

 

your path points to AutoCAD 2010 in the x86-programs path, is that really correct (as you are working on a 64bit system)?

 

>> but when I press 'Pause'-button in VBE2013, to debug my code

Do you press "pause" when the MsgBox is open or later?

What happens if you set a breakpoint at the line where you calling the MsgBox and start then the command?

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 5 of 18 (576 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 04:29 AM in reply to: Alfred.NESWADBA

Hi Alfred

 

AutoCad2010 is installed as 32bit version, to be able to use VBA, so yes this is correct. VBE starts AutoCad correctly..

 

kind regards

 

Wouter

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 6 of 18 (556 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 07:59 AM in reply to: wbdehaan
Wouter, try add reference to accoremgd.dll, then app run again
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 7 of 18 (552 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 08:16 AM in reply to: Hallex

Hi Alfred, 

 

thanks for your assistance, but unfortunately it doesn't work. I added the accoremgd.dll from AutoCad 2014 and added this reference to the project (set copy local false), and then I got 50 errors about the framework incompatability using 3.5 instead of higher. And <CommandMethod("Testprog"> became ambiguous in the autodesk.autocad.runtime namespace.

 

Is it better to downgrade visual studio to 2012 or maybe 2008 again? Or should it be able to work with debugging?

 

kind regards, Wouter

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 8 of 18 (535 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 10:15 AM in reply to: wbdehaan
Wouter,
Try to rebuild a project using 4.0 Net.Framework
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
*Expert Elite*
Alfred.NESWADBA
Posts: 8,982
Registered: ‎06-29-2007
Message 9 of 18 (509 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-15-2014 12:53 PM in reply to: wbdehaan

Hi,

 

accoremgd.dll is only correct for AutoCAD 2013 or 2014, not for AutoCAD 2010.

My question is now: how did you install the 32bit-version of AutoCAD onto your 64bit operating system? Are you using any virtual pc or something similar?

 

>> Is it better to downgrade visual studio to 2012

At least I don't think that this is necessary, the source or the problem is imho not depending on VS2012 or VS2013.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 10 of 18 (481 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-20-2014 03:59 AM in reply to: Alfred.NESWADBA

Hi Alfred & Hallex,  

 

our system-adminstrator installed it using a tool, that makes it possible to install it as 32-bit, because in the 64bit version there is no VBA-support anymore. Therefore it's installed in the program files (x86) directory. 

 

@Hallex : I also tried compiling using framework 4.0 and 4.5, but no success

 

Kind regards,

 

Wouter

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 or visit the Installation and Licensing Forum to get help installing your software.