5 Replies Latest reply on Aug 29, 2014 4:50 PM by Adam Hoffman

    How to register my add-in in vb.net using code

    Adam Hoffman

      Hello, I'm trying to create my first actual add-in using an AngelSix pdf tutorial I found online. Everything is in C# and I am still a newbie at using vb much less C#. I want the code to add my dll to the SolidWorks registry when I build my solution but I don't know how to translate this code into vb. Can anyone give me any pointers?

       

       

      ComRegisterFunction()]

       

      ComRegister(Type t)

       

      keyPath = String.Format(@"SOFTWARE\SolidWorks\AddIns\{0:b}", t.GUID);

       

      (Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(keyPath))

       

      .SetValue(null, 1); // Load at startup

       

      .SetValue("Title", "My SwAddin"); // Title

       

      .SetValue("Description", "All your pixels are belong to us"); // Description

       

      ComUnregisterFunction()]

       

      ComUnregister(Type t)

       

      keyPath = String.Format(@"SOFTWARE\SolidWorks\AddIns\{0:b}", t.GUID);

       

      .Win32.Registry.LocalMachine.DeleteSubKeyTree(keyPath);