Managed application templates for VB and C# Express Editions

My apologies to those expecting more on IP protection in .NET - I ended up deciding to make this interim post regarding a longstanding issue. I'll get right back to the IP question next (I hope :-).

Back in a much earlier post we looked at getting the ObjectARX & Managed Wizards working with the Express editions of Visual Studio. While it was successful enough with C++ Express, VB and C# Express proved to be trickier animals - as was clear from the long thread that followed the post.

Anyway, Cyrille Fauvel, the principle author of various Visual Studio Wizards and all-round guru, took a look at this (which included installing C# Express on a fresh OS install), and confirmed the suspicion that VB and C# Express do not appear to support dialog-based Wizards. It may be possible to get them working by also installing C++ Express or possibly full Visual Studio (for them to really work properly), but that somewhat defeats the object of the exercise.

Well, the good news is that we really don't need a dialog-based Wizard for VB or C# projects - a project template is adequate (thanks to Tim Sprout for suggesting this approach).

Cyrille has worked his magic and created a couple of templates for AutoCAD 2007 VB & C#:

AutoCAD_2007_vb.zip
AutoCAD_2007_cs.zip

Just copy these files into your "My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual Basic" and "C:\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual C#" folders respectively, and you should now see the templates as options when you create a new project. The projects created should also work for AutoCAD 2005 & 2006 - it's just that you'll need to changed the assembly references to point to the correct versions of acmgd.dll and acdbmgd.dll.

Please give them a try and let me know any feedback...

14 responses to “Managed application templates for VB and C# Express Editions”

  1. Mr Kean
    i tried the above mentioned process and still no development if there is any document or a process chart to follow before and after installing Microsoft Visual Basic 2005 express edition and objectarx application wizard i would be glad to follow because i am totally lost.
    regards
    Arun Prasad.H

  2. Hi Arun,

    I'm afraid there isn't anything beyond what's in these blog entries... you might otherwise try posting to the AutoCAD .NET Discussion Group (at discussion.autodesk....).

    Regards,

    Kean

  3. Mr Kean
    Thanks a lot for all your time after many trails of copying your template into many folders of Microsoft Visual Basic 2005 Express Edition i could finally get the template working in my system when i copyed it to "F:\Program Files\Microsoft Visual Studio 8\VB\VBProjects" so thanks a lot.One more question you have said in the template to change the Asdk prefix do i have to change in the template only or do i have to add it to my register?

    regards

    Arun Prasad.H

  4. Hi Arun,

    You can either edit the template or change it in the created project - it's up to you.

    Regards,

    Kean

  5. Arun - You do not have to extract the template from the zip file in order to get it to work. In fact, for it to appear when put into the normal template directory, you must leave it as a zip file.

    By putting it in its extracted form in the folder that you have placed it, it appears as part of the standard templates and not as a user template. This could get overwritten or deleted in a future update.

    Try this. Create a new standard project. Export it to a template and have VS add it into your available templates at the same time with the option that it gives you. Check to see where the zip file has been placed - that´s where you need to place this template zip file as well.

  6. hi...
    I am developing GUI for a finite elment software and i have problem with the use of templates.Actually i am trying to make interface like as we have in SAP 2000(CSI product).I am using Visual Basic 2008 for this.So I need some help in context of Templates.

    Thank YOu
    Ratan

  7. Kean Walmsley Avatar

    Ratan,

    Sorry - these templates have been provided "as is", and I don't know what needs changing for them to work for VS 2008.

    Ultimately the structure of a .NET module for AutoCAD is really simple: create a standard Class Module and add in references to acmgd.dll and acdbmgd.dll, then copy & paste code from nearly any of my posts. That's all there is to it.

    Regards,

    Kean

  8. Mr. Kean,

    I have a problem, in VS 2005 C#, on declaring a variable that references a type that belongs in acmgd.dll and acdbmgd.dll.

    For example, just a simple declaration like: Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

    Although, there is no compilation error, at runtime, when it tries to get into the function it gives me an exception "The type initializer for '<module>' threw an exception.". At the InnerException info it says "The C++ module failed to load during process initialization.\n" on "msvcm80" as Source.

    Do you have an idea about that situation?

  9. Is your assembly being loaded by AutoCAD's NETLOAD command?

    Kean

  10. Mr, Kean,

    Thank you very much for your instant response!!

    No, I am still in the development process, inside Visual Studio.

    Bacos

  11. So what do you mean by "at runtime", then? You need to build a class library (DLL) that you load into AutoCAD.

    Kean

  12. I am building an external application that interacts with AutoCAD exhanging data.

    Bacos

  13. There's your problem: you can't use AutoCAD's .NET API out-of-process. You will need an in-process module (which you can launch and drive via COM, an AutoCAD API which does work across process boundaries).

    Please ask any follow-up questions via the AutoCAD .NET Discussion Group.

    Kean

  14. Indeed that was the problem. I just made a dll and called through AutoCAD and all worked fine.

    Thank you very much!

    Bacos

Leave a Reply

Your email address will not be published. Required fields are marked *