How to set up Visual Studio so you can deploy your AutoCAD .net DLL via an MSI file or .exe Installer

We want our commands “auto loaded”. This means that your commands will be ready, without “netloading”.

After trawling through blogs, and through painful trial and error - here are my findings: the instructional video I wish I had if I was starting from the beginning:

I made a small mistake: within your “ApplicationFolder” Make sure you have another folder called “name-whatever-you-want.bundle” - with a .bundle suffix. Put your contents in there. Sorry for the mistake.

Steps:

Install “Microsoft Visual Studio Installer Projects”

  1. Go to the Visual Studio Market Place

  2. Search for for: “Microsoft Visual Studio Installer Projects”

  3. Filter by the appropriate Visual Studio version you are using

Setup Visual Studio

  • Install DLLs in this location: [ProgramFilesFolder]\Autodesk\ApplicationPlugins
  • Dump all your things in a my-name-is.bundle folder. Make sure it ends with .bundle. Put the PackageContents.xml file as the first file in the bundle folder.
  • Dump your DLLs in a “Contents” folder within the .bundle. This is convention. Make sure your module name reflects the path location of your dll (see the xml file below).

Here is an image which sets it out clearly:

_config.yml

Set up PackageContext.xml

Here is but one example - there are many ways of doing this. (Change the names and file paths to suit your needs) or refer to the examples in the reference links below:

PackageContents.xml

<?xml version="1.0" encoding="utf-8" ?>
<ApplicationPackage
    SchemaVersion="1.0"
    Version="1.0"
    ProductCode=""
    HelpFile=""
    Name="PrecastTools"
    Description="Tools for Precast"
    Author="Ben Koshy" >
	<CompanyDetails
      Name="Tek1"
      Phone="0411022502"      
      Url="www.tek1.com.au"
      Email="ben.chenathara@gmail.com" />
	<Components>
		<RuntimeRequirements
		  OS="Win64"
		  Platform="AutoCAD" />
		<ComponentEntry
		  AppName="PrecastTooks"
		  ModuleName="./Contents/PrecastTools.dll"
		  AppDescription="Helps handle brick snaps"
		  LoadOnCommandInvocation="True"
		  LoadOnAutoCADStartup="False">
			<Commands GroupName="Commands">
				<Command Global="Hey" Local="IJustMetYouAndThisIsCrazy" />
				<Command Global="SPLITBRICKS" Local="SPLITBRICKS" />				
			</Commands>
		</ComponentEntry>
	</Components>
</ApplicationPackage>

Distribute

Build and then distribute your MSI or your exe Installer.

Written on November 14, 2022