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
Solved! Go to Solution.
Solved by wbdehaan. Go to Solution.
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 -
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:
I tried the option: use managed compatibility mode in Tools > Options
and also Enable native code debugging, but it doesn't work
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
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 -
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
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
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 -
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
Hi,
may I come back to that question from post 4 in this thread?
>> What happens if you set a breakpoint at the line where you calling the MsgBox and start then the command?
Does it stop or does it ignore the breakpoint?
- alfred -
Hi Alfred,
it ignores the breakpoint completely.
f.y.i.: It starts the correct (debug)-dll, because when I stop the running project and change the text in the messagebox and rerun the netload command in AutoCad, it shows the change in text, therefore i'm sure it's not loading a different dll.
kind regards, Wouter
Hi,
I'm sorry not to have any more ideas what I can do from the distance.
Maybe playing with the ACAD.EXE.CONFIG might be a help, but I have not the environment with a ACAD2010x32 installed on a 64bit OD. The only thing I can say is that development/debugging in Win7x64 with VS2013 and Civil3D2010 (which is 32bit as there was no 64bit version availaible) does work well.
Sorry, - alfred -
Hi Alfred,
thanks for your effort, I will try to install a previous version of VBE (because debugging Autocad2010 with VBE 2008 worked well), or maybe try the installation on a different computer)
kind regards, Wouter
Hi Alfred,
When I use autoCad 2014 (64bit installed on 64Bit machine) and VBE 2013, i'm still not able to debug...and it seems like the project isn't loaded, when I use netload in AutoCad.
tried:
also tried:
- Loading accoremgd.dll, then it gives lot's of warnings:
Warning 1 The primary reference "accoremgd" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework. testproject
> tried rebuilding project:
maybe there's a solution to this, and otherwise i'll ask the system operator for installing an older version of VBE, 2012 or maybe back to the working 2008 version. Thanx in advance,
kind regards, Wouter
Hi,
can you upload a (small) sample project?
I try to start this on my system, do the corrections, if necessary, and send it back ... for you to try.
- alfred -
Hi Alfred,
in this mail there is an attachment with a small "hello world"-msgbox project
When I netload this project (the debug-version), it first gives me a warning about not trusted* project, I choose Load
* added d:\vbet\ to my trustedpaths, but seems like it doesn't read the subdir's inside, so i added the complete path to the dll, that works)
then it doesn't start the program, like it does on AutoCad2010.
---
below the added code in de class1.vb, with a breakpoint on 'Dim Temptext ..'
Imports Autodesk.AutoCAD.Runtime Public Module testModule <CommandMethod("testprog")> Public Sub main() Dim TempText As String = "Hello World" MsgBox(TempText) End Sub End Module
For your information:
- Menu Tools > Options > Debugging > Use Managed Compatibility mode = checked
- Solution Explorer > My Project > Menu Debug > checkbox Enable native code debugging = unchecked
- Solution Explorer > My Project > Menu References > add dll Microsoft ActiveX Data Objects 6.1, because of future connection with SQL-server, is not neccessary at this moment,
kind regards
Wouter
Hi Alfred,
finally i found a solution. I downgraded my Visual Basic Express 2013 to Visual Basic Express 2010, and still debugging didn't work at begin. Then I found a solution from Kean Walmsley:
and used solution 2:
"The cause of the problem boils down to the fact that VS 2010 does not choose the right version of the debugger for Class Library projects targeting prior versions of the .NET Framework: it always uses the default version, the debugger targeting v4 of the .NET Framework. This debugger doesn’t see breakpoints in projects targeting older versions of .NET."
Solution 2
Modify the config file of the exe that loads your AddIn (acad.exe.config, revit.exe.config, etc) so that it contains the following just before the
</configuration> <startup> <supportedRuntime version="v2.0.50727" /> </startup>
that worked! Now I can try to do the same when using VBE2013.
Using AutoCad 2010 (installed as 32bit on a 64bit machine, using Windows 7)
thanks for all your effort!
kind regards
Wouter