In project start up options I set to run acad.exe. I set up output directory for my plugin to the same path, that at in the AutoCAD registry. So, when I hit F5 key AutoCAD starts and it loads just builded version of plugin. I set breakpoint at IExtensionApplication.Initialize() methodand it works perferctly. But when during debug I try to call some method marked with [CommandMethod("Method")] attribute AutoCAD says, that the commandis unknown. When I start AutoCAD with the same dll (but not from debug) is see all my method marked with [CommandMethod()] attribute.
Previously I used Visual Studio 2008 with same AutoCAD version but I had no problem with debugging. Please, help.
My solutions for VisStudio 2010+AutoCAD 2011 are:
I:edit: acad.exe.config, add
<supportedRuntime version="v2.0.50727" />
1. Right-click the Solution in the Solution Explorer and select Add -> Existing Project... >acad.exe
2. Right-click on the Project that has just been added and select Set as StartUp Project
3. Right-click on the Project and select Properties
4. Set the Debugger Type to Managed (v2.0, v1.1, v1.0)
So, It seem that you didn't understand me.
Debugging works well and all breakpoints are available. But when I try to call some Command from AutoCAD it says, that this Command is Unknown. Only if I in debug mode.
I want to remind, that breakpoint at IExtensionApplication.Initialize() works well and I can debug this method. I've marked this method with "Command" attribute and it is called on assembly load and I can debug it, but when plugin initialization finishes, I cannot call the method. AutoCAD environment says "Unknown command"
Some more symptoms that may be can help to find solution
1 I start AutoCAD and I can to run any command from my plugin.
2 I attach to acad.exe process and all breakpoints becomes available
3 When I try to call some command to rich my break point than AutoCAD hangs
1 or more things is happening.
1. Your dll you reference in Debug is not there when it runs without debug, or the path has changed to it, or something like that.
2. You are not autoloading it, and need to force netload it.
What I would do... I would run ACAD normally, and then force load the dll manually (NETLOAD command). If that is working ok, then I would check the registry entry to see if it is properly mapped for the CURRENT user. Yep it can be different for every user.
If you didn't make it past the first idea, then possibly the dll, is trying to copy to source the acad dlls (bad mojo), and that causes the Netloading process to abort.