6 Replies Latest reply on Jul 8, 2014 4:27 AM by Jingwei Wang

    x86 add-in can not work in x64

    Jingwei Wang

      Hello, everybody. I have a big problem now. My x86 add-in by vb.net can not work in x64, error says the assembly can not be registered..., then I tried almost all methods available online, the problem is still there.

      Then I make a test in a another new laptop with win7 x64 and solidworks  x64, after I install the Api sdk, I use the swVBaddin template to run a project. It must be working, but no. The same error  "the assembly can not be registered..." comes out again.  This makes me really sad, x86 addin works so fine, x64 add-in is so awful. How can I solve this problem? Who can save my life? I need you help.

        • Re: x86 add-in can not work in x64
          Artem Taturevych

          Hello, you need to use 'Any CPU' while developing the .NET add-in and use either x64 version of Regasm or x32 version of regasm to register on target machines. The dll should be the same. Please check this video: https://www.youtube.com/watch?v=5Qy7KKy8-fE

           

          Thanks,

          Artem

            • Re: x86 add-in can not work in x64
              Jingwei Wang

              Thanks at first ! I watched your video and now the question is should I also add a key to the registry editor at first and then use Regasm to register dll? Or  I can directly use Regasm to register my dll in target machine?

                • Re: x86 add-in can not work in x64
                  Artem Taturevych

                  Hi,

                   

                  If you are using the standard SDK template you do not need to add the key. The video shows how to create an add-in from scratch. In your add-in you should be able to find the function with a ComRegisterFunction attribute where some registry manipulation are done. So when you register your dll with RegAsm this function is invoked and the registry keys are added. Make sure you see them after registration.

                   

                  Thanks,

                  Artem

                    • Re: x86 add-in can not work in x64
                      Jingwei Wang

                      Artem, thank you again! But new problem comes out. In my program, I just modify the call back function of Createcube of template with creating and  showing  my userform. In my computer win7 x86, it works fine, in target machine win7 x64 with Solidworks x64,I  try add in the  modules and form created from my computer win7 x86 to set up a same project, but it brings me a disaster. The problem is:

                       

                      see the end of this message for details on invoking

                      just-in-time (JIT) debugging instead of this dialog box.

                       

                       

                      ************** Exception Text **************

                      System.OverflowException: Arithmetic operation resulted in an overflow.

                         at www.FileTimetoUtc.ConvertFileTimeToDateTime(FILETIME input) in C:\Users\wjw\Documents\Visual Studio 2010\Projects\www\www\FileTimetoUtc.vb:line 4

                         at www.GetFtpDirectoryContent.GetCurrentDirectoryContent(String strPathName) in C:\Users\wjw\Documents\Visual Studio 2010\Projects\www\www\GetFtpDirectoryContent.vb:line 40

                         at www.FtpForm.cmdConnect_Click(Object sender, EventArgs e) in C:\Users\wjw\Documents\Visual Studio 2010\Projects\www\www\Form1.vb:line 97

                         at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

                         at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

                         at System.Windows.Forms.Control.WndProc(Message& m)

                         at System.Windows.Forms.ButtonBase.WndProc(Message& m)

                         at System.Windows.Forms.Button.WndProc(Message& m)

                         at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

                       

                       

                       

                       

                      ************** Loaded Assemblies **************

                      mscorlib

                          Assembly Version: 4.0.0.0

                          Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

                          CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

                      ----------------------------------------

                      www

                          Assembly Version: 1.0.5300.40425

                          Win32 Version: 1.0.5300.40425

                          CodeBase: file:///C:/Users/wjw/Documents/Visual%20Studio%202010/Projects/www/www/bin/www.DLL

                      ----------------------------------------

                      SolidWorksTools

                          Assembly Version: 2.0.0.0

                          Win32 Version: 2.0.0.0

                          CodeBase: file:///C:/Program%20Files/SolidWorks%20Corp/SolidWorks/SolidWorksTools.DLL

                      ----------------------------------------

                      System.Drawing

                          Assembly Version: 4.0.0.0

                          Win32 Version: 4.0.30319.1 built by: RTMRel

                          CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

                      ----------------------------------------

                      System

                          Assembly Version: 4.0.0.0

                          Win32 Version: 4.0.30319.1 built by: RTMRel

                          CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

                      ----------------------------------------

                      System.Core

                          Assembly Version: 4.0.0.0

                          Win32 Version: 4.0.30319.1 built by: RTMRel

                          CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

                      ----------------------------------------

                      Microsoft.VisualBasic

                          Assembly Version: 10.0.0.0

                          Win32 Version: 10.0.30319.1 built by: RTMRel

                          CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll

                      ----------------------------------------

                      System.Windows.Forms

                          Assembly Version: 4.0.0.0

                          Win32 Version: 4.0.30319.1 built by: RTMRel

                          CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

                      ----------------------------------------

                       

                       

                      ************** JIT Debugging **************

                      To enable just-in-time (JIT) debugging, the .config file for this

                      application or computer (machine.config) must have the

                      jitDebugging value set in the system.windows.forms section.

                      The application must also be compiled with debugging

                      enabled.

                       

                       

                      For example:

                       

                       

                      <configuration>

                          <system.windows.forms jitDebugging="true" />

                      </configuration>

                       

                       

                      When JIT debugging is enabled, any unhandled exception

                      will be sent to the JIT debugger registered on the computer

                      rather than be handled by this dialog box.