Loading the COM Module
Copying the Amt COM Module files
When the Amt COM Module will be used on a machine which does not have an installed AMT Environment, it is necessary to copy the Amt COM Module library files to this machine.
To do this copy the contents of the folder <Your AMT Environment>\AmtTools\ComModule, from a server with an installed AMT Environment, to a folder on the machine the Amt COM Module will be used.
A Side-by-side assembly manifest (application manifest) file, named 'Asysco.Amt.LionCommodule.X.manifest', is also located in the ComModule folder.
Visual Basic
Please be aware that the Amt Com Module has limited functionality in non .NET languages due to restrictions of COM services. As such the module should only be used in non .NET languages to maintain legacy applications. |
Note regarding the 32-bit version comhost |
---|
Only a 64-bit version of the COM Module comhost is available by default in AMT. However, a 32-bit version is available on demand through contact in the Avanade Service Portal. |
Registering the Amt COM Module
Before the Amt COM Module can be used in a Visual Basic (Script) program it first has to be registered as a COM service in the Windows Operating System:
- Register the AMT COM module named 'Asysco.Amt.LionCommodule.comhost.dll', using
Regsvr32.exe. This can be done by executing the following command in an elevated (Run as administrator)
Command Prompt window:
Regsvr32.exe <Path to COMModule>\Asysco.Amt.LionCommodule.comhost.dll
The <Path to COMModule> must refer to the directory to where you have copied the concerned dll-files.
Regsvr32.exe can be found in the
C:\Windows\System32 folder.
Note that on a 64-bit version of the Windows operating system, there are two versions of the Regsv32.exe file:
- The 64-bit version is %systemroot%\System32\regsvr32.exe.
- The 32-bit version is %systemroot%\SysWoW64\regsvr32.exe.
Be sure to use the correct version of Regsvr32.exe depending on the application that will use the Amt COM
Module.
Unregistering the Amt COM Module
It is important when upgrading AMT to a new fix or patch to first unregister the old Com module with the
command
regsvr32.exe /u <Path to
COMModule>\Asysco.Amt.LionCommodule.comhost.dll
and then register the new version after AMT was
upgraded.
To unregister older .NET framework versions of the COM module, the following command can be used: Regasm /unregister <Path to COMModule>\Asysco.Amt.LionCommodule.dll |
Loading the Module
When starting the Visual Basic program the Amt COM Module has to be loaded into memory and an object of the basic AmtCOMModule class has to be created. The code to do this is:
Powershell
Add-Type -Path '<Path to COMModule>\Asysco.Amt.LionCommodule.dll'
# Then create a COM Module object
$AmtCom = New-Object Asysco.Amt.LionClient.ComModule.AmtLionComConnection
C# (.NET)
Refering to the Asysco.Amt.LionCommodule dll
Open (Create) the project to use the Com Module in, in Visual Studio. Then right click the References node of the project and click 'Add Reference'. Browse to the folder <Your Environment>\AmtTools\ComModule and add a reference to the Asysco.Amt.LionCommodule.dll.
The COM Module can then be used in the code of the project.
It is advised to add a 'using
Asysco.Amt.LionClient.ComModule;' directive to every code file the COM Module will be used.
|