12 Replies Latest reply on Sep 10, 2016 5:57 AM by Chiheb Gouta

    Add-in install with installshield problem

    Chiheb Gouta

      Experts

       

      I have developed a SOLIDWORKS Add-in from the sample Add-in provided from SOLIDWORKS SDK.
      I have generated the .exe installer with installsheild suceffully and when instaling the setupe file, everything is OK.
      My problem is that the add-in does not appear in SOLIDWORKS and in the register of windows althgouth there is the code "Solidoworks Registration in the code file:

       

       

       

      <Guid("52376cbd-bf9c-4bc4-945b-f452c6ce0a71")>
      <ComVisible(True)> _
          <SwAddin( _
              Description:="SwVBAddin1 description", _
              Title:="SwVBAddin1", _
              LoadAtStartup:=True _
              )> _
      Public Class SwAddin
          Implements SolidWorks.Interop.swpublished.SwAddin
      
      
      #Region "Local Variables"
          Dim iCmdMgr As ICommandManager
          Dim addinID As Integer
          Dim openDocs As Hashtable
          Dim SwEventPtr As SldWorks
          Dim ppage As UserPMPage
          Dim iBmp As BitmapHandler
          Public Const mainCmdGroupID As Integer = 0
          Public Const mainItemID1 As Integer = 0
          Public Const mainItemID2 As Integer = 1
          Public Const mainItemID3 As Integer = 2
          Public Const mainItemID4 As Integer = 3
          'Public Const flyoutGroupID As Integer = 91
      
      
          ' Public Properties
          ReadOnly Property SwApp() As SldWorks
              Get
                  Return iSwApp
              End Get
          End Property
      
      
          ReadOnly Property CmdMgr() As ICommandManager
              Get
                  Return iCmdMgr
              End Get
          End Property
          ReadOnly Property OpenDocumentsTable() As Hashtable
              Get
                  Return openDocs
              End Get
          End Property
      #End Region
      #Region "SolidWorks Registration"
          <ComRegisterFunction()> Public Shared Sub RegisterFunction(ByVal t As Type)
              ' Get Custom Attribute: SwAddinAttribute
              Dim attributes() As Object
              Dim SWattr As SwAddinAttribute = Nothing
              attributes = System.Attribute.GetCustomAttributes(GetType(SwAddin), GetType(SwAddinAttribute))
              If attributes.Length > 0 Then
                  SWattr = DirectCast(attributes(0), SwAddinAttribute)
              End If
              Try
                  Dim hklm As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine
                  Dim hkcu As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser
                  Dim keyname As String = "SOFTWARE\SolidWorks\Addins\{" + t.GUID.ToString() + "}"
                  Dim addinkey As Microsoft.Win32.RegistryKey = hklm.CreateSubKey(keyname)
                  addinkey.SetValue(Nothing, 0)
                  addinkey.SetValue("Description", SWattr.Description)
                  addinkey.SetValue("Title", SWattr.Title)
                  keyname = "Software\SolidWorks\AddInsStartup\{" + t.GUID.ToString() + "}"
                  addinkey = hkcu.CreateSubKey(keyname)
                  addinkey.SetValue(Nothing, SWattr.LoadAtStartup, Microsoft.Win32.RegistryValueKind.DWord)
              Catch nl As System.NullReferenceException
                  Console.WriteLine("There was a problem registering this dll: SWattr is null.\n " & nl.Message)
                  System.Windows.Forms.MessageBox.Show("There was a problem registering this dll: SWattr is null.\n" & nl.Message)
              Catch e As System.Exception
                  Console.WriteLine("There was a problem registering this dll: " & e.Message)
                  System.Windows.Forms.MessageBox.Show("There was a problem registering this dll: " & e.Message)
              End Try
          End Sub
      


      I have search a lot in the forum and internet and I didn't find the solution. Can anyone help and thank you very much.

       

      I have  SOLIDWORKS 2016
      Windows 7 x64