Page 1 of 1
When to Register or UnRegister Assemblies
Posted: Thu Jul 14, 2011 7:46 am
by MattWilkinson
I am using the
Run Program command to register my .NET DLL for COM Interop as follows:
Code: Select all
Run Program $WINDIR$Microsoft.NET\Framework\v4.0.30319\RegAsm.exe "$TARGETDIR$\Bin\VizualData.dll" /codebase /silent
The problem I had however was that if I installed an older version of my package - it did not
unregister the DLL correctly so I added an unregistration just before the
command - in the section:
This has had the effect that it is now not correctly
registering my files
Can someone tell me at which point(s) I should be
a) Registering files
b) Unregistering files
Thanks
Re: When to Register or UnRegister Assemblies
Posted: Thu Jul 14, 2011 8:48 am
by bokkie
Matt, I've probably misunderstood your problem but in the InstallFiles command there's a checkbox that does the self-registering of DLLs. Is that of any help?
Re: When to Register or UnRegister Assemblies
Posted: Thu Jul 14, 2011 8:56 am
by MattWilkinson
Well that might help - the InstallAware help file doesn't give any clue as to what that does though:
Does it run RegAsm?
Which .NET framework RegAsm will it register it with? The latest found on the machine? The one used to build the assembly?
Does it register in the GAC or in the target location?
Does it register for COM Interop?
Who knows?
It is safer to call the commands myself - but my question is at which points in the script?
Re: When to Register or UnRegister Assemblies
Posted: Thu Jul 14, 2011 11:28 am
by giaviv
Hi,
Please read about the Install Assembly command (or the Assembly section in the Design tab).
This command allows you to install an assembly, register it for COM interop, run regasm on it, run ngen on it, register it to the GAC and more.
Re: When to Register or UnRegister Assemblies
Posted: Mon Jul 18, 2011 2:13 am
by MattWilkinson
I have looked at this command however there some fundamental issues with this command:
The help file does not mention anything about regasm in the Install Assembly page:
There is no way to enable regasm in the MSICode tab and indeed you can't even see that it is enabled in this tab
There is no mention of how to invoke command line switches /codebase /tlb for example
Which framework version does it register against? The latest? The same one as the assembly?
What happens if the .NET framework is not installed? or regasm cannot be found
As usual the help file is severely lacking in content and the design and MSI code tab options differ.
Re: When to Register or UnRegister Assemblies
Posted: Mon Jul 18, 2011 11:37 am
by giaviv
The Install Assembly command doesn't register and assembly, it only installs the actual file to the target machine.
The Register Assembly command, which is emitted by the IDE when you select register assembly in the Design tab, handles the registering of the assembly.
All the other options are there as well.
I am sorry you feel that our help files are lacking, but I beg to differ. By simply selecting regasm in the Design tab you could see the Register Assembly command being emitted. Also, you can search the help files for "register assembly" and read about the command.
Re: When to Register or UnRegister Assemblies
Posted: Tue Jul 19, 2011 1:59 am
by MattWilkinson
I'm sorry, but the help file does not mention anything about regasm in the Register Assembly page either!
So I assume that the 'Set codebase in the registry' is effectively using the /codebase switch?
Is there a way to invoke the /tlb switch?
Could you also please answer my earlier question regarding which framework version is used:
Which framework version does it register against?
The latest?
The same one as the assembly?
What about 64 bit frameworks / assemblies?
Thanks
Re: When to Register or UnRegister Assemblies
Posted: Tue Jul 19, 2011 12:35 pm
by giaviv
Hi,
Register Assembly is simply regasm.
Codebase does set the /codebase flag. There is no integrated way to run /tlb, you would have to use Run Program for that, and pass regasm.exe the /tlb flag.
About your other question, IA invokes the latest version of regasm available (and thr x64 version if exists).
Re: When to Register or UnRegister Assemblies
Posted: Wed Jul 20, 2011 1:51 am
by MattWilkinson
OK so I need to use run program then to use the /tlb switch which goes back to my original post:
At which point(s) I should be running regasm and which point(s) I should be running regasm /unregister
Also I believe that if you try to register a 32 bit assembly using regasm64 then this will fail so register assembly is flawed if it works as you described
Re: When to Register or UnRegister Assemblies
Posted: Wed Jul 20, 2011 2:42 pm
by giaviv
The correct bit version is invoked for the assembly so that the registration works.
If you are not using the Native Engine, call register after Apply Install, and unregister before Apply Uninstall.
Otherwise, call it after Install Assembly, or before Apply Uninstall