Skip to content

Instantly share code, notes, and snippets.

@tngan
Last active September 30, 2021 22:35
Show Gist options
  • Save tngan/8e3f3a3417f814a88372 to your computer and use it in GitHub Desktop.
Save tngan/8e3f3a3417f814a88372 to your computer and use it in GitHub Desktop.
AutoCAD .NET development cheatsheet
<?xml version="1.0" encoding="utf-8" ?>
<!--
This file is used to define the autoloader. The folder structure is shown as follow:
Sample.bundle
|- Contents
|- Sample.dll and its dependencies and reference
|- Resources
|- CUIFORAUTOCADMAP3D.cuix
|- CUIFORAUTOCAD.cuix
The tag <RuntimeRequirements> is inserted to specify the loading environment of partial customization, in case of some ribbons can only applicable for some AutoDesk vertical softwares.
The parameter PLATFORM specifies which vertical programs is applicable, the following items are the options.
ACADE - AutoCAD Electrical
ACADM - AutoCAD Mechanical
ACLT - AutoCAD LT
ADT - Architectural Desktop
AIP - Inventor Professional
AIPRS - Inventor Professional for Routed Systems
AIPSIM - Inventor Professional for Simulation
AIS - Inventor Series
AOEM - AutoCAD OEM
AutoCAD - AutoCAD
AutoCAD* - All AutoCAD-based products
Civil - Autodesk Civil
Civil3D - Autodesk Civil 3D
LDT - Land Desktop
Map - AutoCAD Map 3D
MEP - AutoCAD MEP
Plant3D - AutoCAD Plant 3D
PNID - AutoCAD P & ID - 2D
-->
<ApplicationPackage SchemaVersion="1.0" AppVersion="1.0"
ProductCode="{1A2B3C4D-5E6F-7A8B-9C0D-3F6399985C6A}"
Author="Tony Ngan"
Name="A sample application"
Description="Demo use"
>
<RuntimeRequirements
OS="Win64"
Platform="AutoCAD*"
SeriesMin="R20"
SeriesMax="R20"
/>
<Components>
<ComponentEntry
ModuleName="./Contents/Sample.dll"
AppName="Sample"
AppDescription=""
LoadOnAutoCADStartup="True"
/>
<ComponentEntry
AppName="Sample"
Version="1.0.0"
ModuleName="./Contents/Resources/CUIFORAUTOCADMAP3D.cuix"
>
<RuntimeRequirements
OS="Win64"
Platform="Map"
SeriesMin="R20"
SeriesMax="R20"
/>
</ComponentEntry>
<ComponentEntry
AppName="Sample"
Version="1.0.0"
ModuleName="./Contents/Resources/CUIFORAUTOCAD.cuix"
>
<RuntimeRequirements
OS="Win64"
Platform="AutoCAD"
SeriesMin="R20"
SeriesMax="R20"
/>
</ComponentEntry>
</Components>
</ApplicationPackage>
Simplify the plug-in installation by making a classic .msi
Please follow the following link to build up
http://through-the-interface.typepad.com/through_the_interface/2010/09/building-an-installer-part-1.html
http://through-the-interface.typepad.com/through_the_interface/2010/09/building-an-installer-part-2.html
http://through-the-interface.typepad.com/through_the_interface/2010/09/building-an-installer-part-3.html
However, that's not enough since it only checks the most recent version of AutoCAD or its vertical. Therefore, we have to modify something.
1. From the setup project, right click and select view -> launch conditions
2. In the Search Target Machine folder, right click and select Add Registry Check Create the following items as you need.
AutoCAD version
Name: AutoCAD version
Property: ACADSERIALNUM
RegKey: SOFTWARE\Autodesk\AutoCAD\R20.0\ACAD-E001
Root: vsdrrHKCU
Value: ACADSERIALNUMBER
Map3D version
Name: Map3D version
Property: ACADM3DSERIALNUM
RegKey: SOFTWARE\Autodesk\AutoCAD\R20.0\ACAD-E002
Root: vsdrrHKCU
Value: ACADSERIALNUMBER
3. In the Launch Conditions, right click and Add Launch Condition
Name: AutoCAD & Map3D Version Check
Condition: ACADSERIALNUM != "" || ACADM3DSERIALNUM != ""
RegKey: SOFTWARE\Autodesk\AutoCAD\R20.0\ACAD-E002
InstallUrl: vsdrrHKCU
Message: Error
4. Rebuild the setup project
FYI: http://adndevblog.typepad.com/autocad/2013/08/registry-values-for-productid-and-localeid-for-autocad.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment