Message 1 of 2
Error installing Addin

Not applicable
07-22-2014
04:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I created an Setup project to install my AutoCAD Addin, based in your code
"Develop Applications with VB.NET and C# / Distribute Your Application"
You can see my code below.
I get the following error in the installation
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Install; using System.Linq; using System.IO; using System.Reflection; using Microsoft.Win32; using Autodesk.AutoCAD.DatabaseServices; namespace eGrouWSAutoCADAddin { [RunInstaller(true)] public partial class AddinInstaller : System.Configuration.Install.Installer { StreamWriter icl_installLog; public AddinInstaller() { InitializeComponent(); } public override void Install(System.Collections.IDictionary stateSaver) { // Gets the parameter passed across in the CustomActionData. icl_installLog = new StreamWriter("_eGrouWSAutoCADAddInSetup.log"); icl_installLog.AutoFlush = true; try { m_InstallAddin(stateSaver); } finally { icl_installLog.WriteLine("Ending edit of config file"); icl_installLog.Close(); } } public void m_InstallAddin(System.Collections.IDictionary stateSaver) { try { base.Install(stateSaver); // Get the AutoCAD Applications key string sProdKey = HostApplicationServices.Current.MachineRegistryProductRootKey; string sAppName = "eGrouWSAutoCADAddin"; RegistryKey regAcadProdKey = Registry.CurrentUser.OpenSubKey(sProdKey); RegistryKey regAcadAppKey = regAcadProdKey.OpenSubKey("Applications", true); // Check to see if the "MyApp" key exists string[] subKeys = regAcadAppKey.GetSubKeyNames(); foreach (string subKey in subKeys) { // If the application is already registered, exit if (subKey.Equals(sAppName)) { regAcadAppKey.Close(); return; } } // Get the location of this module string sAssemblyPath = Assembly.GetExecutingAssembly().Location; // Register the application RegistryKey regAppAddInKey = regAcadAppKey.CreateSubKey(sAppName); regAppAddInKey.SetValue("DESCRIPTION", sAppName, RegistryValueKind.String); regAppAddInKey.SetValue("LOADCTRLS", 14, RegistryValueKind.DWord); regAppAddInKey.SetValue("LOADER", sAssemblyPath, RegistryValueKind.String); regAppAddInKey.SetValue("MANAGED", 1, RegistryValueKind.DWord); regAcadAppKey.Close(); } catch (InstallException ex) { throw new InstallException(ex.Message); } catch { throw new InstallException("Error installing addin!"); } } public override void Uninstall(System.Collections.IDictionary stateSaver) { // Gets the parameter passed across in the CustomActionData. icl_installLog = new StreamWriter("eGrouWSAutoCADAddin.log"); icl_installLog.AutoFlush = true; try { m_UninstallAddin(stateSaver); } finally { icl_installLog.WriteLine("Ending edit of config file"); icl_installLog.Close(); } } public void m_UninstallAddin(IDictionary savedState) { try { // Get the AutoCAD Applications key string sProdKey = HostApplicationServices.Current.MachineRegistryProductRootKey; string sAppName = "eGrouWSAutoCADAddin"; RegistryKey regAcadProdKey = Registry.CurrentUser.OpenSubKey(sProdKey); RegistryKey regAcadAppKey = regAcadProdKey.OpenSubKey("Applications", true); // Delete the key for the application regAcadAppKey.DeleteSubKeyTree(sAppName); regAcadAppKey.Close(); } catch { } base.Uninstall(savedState); } } }