Still having trouble with Add-ins on 64 bit system

Still having trouble with Add-ins on 64 bit system

Anonymous
Not applicable
827 Views
4 Replies
Message 1 of 5

Still having trouble with Add-ins on 64 bit system

Anonymous
Not applicable
I've read the article from the help files concerning 64 bit add-in as suggested by Sanjay. And everything I'm doing seems to be correct, yet the add-in does not sem to be loaded by Inventor. I've checked the registry and the add-in is registered in the HKCR registry (and also in the Wow6432 Node) they have the correct CSLID. So it seems that Inventor simply is not loading the Add-in. When I run the .bat file to register the addin.

@echo off
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe /codebase EventMonitor.dll
PAUSE

I get this message on the Dos screen

RegAsm : error RA0000 : Unable to locate input assembly 'EventMonitor.dll' or one of its dependencies
Press any key to continue...

This is the same code that ran loaded flawlessly on a 64 bit machine at my previous job. The only theory I have is this. We're sorting out an activation code with AutodeskTthe Inventor software I'm running currently it is not activated, I'm running the trial version of the software. Is this the possible reason that the add-in wont load?
0 Likes
828 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Specify the directory that your DLL is in:

{code}
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe /codebase "c:\Program Directory\EventMonitor.dll"
{code}
0 Likes
Message 3 of 5

Anonymous
Not applicable
That did the trick Thanks!
0 Likes
Message 4 of 5

Anonymous
Not applicable
Does anyone know how to automatically take care of this process in a setup project? I've added vb script files to the setup project which handles dll registering and unregistering, but after running the install the add-in is not available to Inventor.

Does anyone have a solution or suggestion?

Register64.vbs (custom action added to the commit section of the setup project):

dim ret
dim cmd
dim InstallLoc

Set WshShell = CreateObject ("WScript.Shell")
'Find out where the various pieces were installed by looking
'at the CustomActionData property passed from the installer
If(IsEmpty(Session)) Then
'Not running from within the installer. Get the source path based
'on the current folder.
InstallLoc = ""
Else
'Running inside the installer, so use the CustomActionData
InstallLoc = Session.Property("CustomActionData")
End If
cmd = "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\regasm /codebase " & chr(34) & InstallLoc & myAddInFileName & chr(34)
ret = WshShell.Run (cmd, 7, true)

if ret = 0 then
WshShell.LogEvent 0, "AddIn succesfully registered"
else
WshShell.LogEvent 1, "AddIn registration failed (" & ret & ") Current directory: " & WshShell.CurrentDirectory & chr(13) & chr(10) & " cmd: " & cmd
end if

set WshShell = nothing

System Conditions:

Windows 7 64-bit
Visual Studio 2008
Inventor 2010
0 Likes
Message 5 of 5

Anonymous
Not applicable
I add an Installer Class to the project (In VS2008, Add New Item - > General -> Installer Class) and insert the two event handlers:

{code}
Private Sub InventorAddinInstaller_Committed(ByVal sender As Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles Me.Committed
Try
Dim assemblyPath As String = Context.Parameters.Item("assemblypath")
Dim winDir As String = System.Environment.GetEnvironmentVariable("windir")

If System.Environment.GetEnvironmentVariable("ProgramFiles(x86)") IsNot Nothing Then
'For 64 Bit only
System.Diagnostics.Process.Start(IO.Path.Combine(winDir, "Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe"), "/codebase " + """" + assemblyPath + """").WaitForExit()
Else
'For 32 bit only
System.Diagnostics.Process.Start(IO.Path.Combine(winDir, "Microsoft.NET\Framework\v2.0.50727\RegAsm.exe"), "/codebase " + """" + assemblyPath + """").WaitForExit()
End If
Catch ex As Exception
End Try
End Sub
Private Sub InventorAddinInstaller_BeforeUninstall(ByVal sender As Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles Me.BeforeUninstall
Try
Dim assemblyPath As String = Context.Parameters.Item("assemblypath")
Dim winDir As String = System.Environment.GetEnvironmentVariable("windir")
If System.Environment.GetEnvironmentVariable("ProgramFiles(x86)") IsNot Nothing Then
'For 64 Bit only
System.Diagnostics.Process.Start(IO.Path.Combine(winDir, "Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe"), "/unregister " + """" + assemblyPath + """").WaitForExit()
Else
'For 32 bit only
System.Diagnostics.Process.Start(IO.Path.Combine(winDir, "Microsoft.NET\Framework\v2.0.50727\RegAsm.exe"), "/unregister " + """" + assemblyPath + """").WaitForExit()
End If
Catch ex As Exception
End Try
End Sub
{code}

Then in the setup project's custom actions, add the action of the project output (Right click on the Custom Actions header, select Add Custom Action..., then find your Primary output from PROJECT and select it).

These handlers automatically determine whether the running OS is 32 bit or 64 bit, but it's very important whether your setup project targets x86 or x64. I usually create two setup projects, one for 32 bit and the other for 64.
0 Likes