Use Regasm From .bat
Hi,I have an ASP Classic application which references some VB6 COM OBJECTS. One of these VB6 COM OBJECTS reference another 3rd Party.Net DLL.The 3rd party.Net DLL needs to be registered on a Windows Server 2008 R2 x64 machine.I have found scripts to register the DLL in the GAC without GACUTIL using powershell (ref:)Now I need to register the assembly. I have used both the GACUTIL and the REGASM on my local development machine (x86) without hitch. But when I try to get the DLL on the testing server I have problems.First issue: NO GACUTILThere is no GACUTIL on the server, which I got around using script noted above. I understand that it can be installed using the SDK but I do not want to 'pollute' the environment.Second issue: REGASM CANNOT FIND ASSEMBLYThe REGASM under the 32bit.Net Framework does not find the DLL.
If there is only one 'RegAsm.exe' program in your computer, and you have installed several versions of.net framework, this cause should be you installed the other versions without.net tools and installed the latest version with tools. In another words, the tool 'RegAsm.exe' isnot attached to.net framework. Create.bat file with this code: C: Windows Microsoft.NET Framework64 v4.0.30319 RegAsm.exe /codebase FULLPATHTODLLFILE Run this bat file as Administrator (Right-click - Run as Administrator, or run CMD line as admin and run it from there to see the results).
Error reported: 'RegAsm: error RA0000: Unable to locate input assembly 'C:WindowsSystem32xxxxx.dll' or one of its dependencies.' So I used the 64bit variant of RegAsm and that worked.My concern though is that it is a false positive in that the ASP classic does not find the assembly as it is not registered by the 32bit RegAsm.I run my application I get errors in my event log: 'ActiveX component can't create object'. Generally speaking that happens because it cannot find the object to create, which means that the DLL hosting the object is not registered correctly.So what I am trying to do now is find out if there is an alternate method to REGASM using powershell that will register the assembly in the 32Bit scope.Does anyone know if that is possible and what the script would be to get it right? Hi,I found out that I was placing the.Net DLL in the incorrect folder on the test machine for registration.On a windows 64Bit OS you have the System32 and the SysWOW64 folders. I placed my DLL in the System32 folder, where it should have been in the SysWOW64 folder.The error I got from RegAsm ('RegAsm: error RA0000: Unable to locate input assembly 'C:WindowsSystem32xxxxx.dll' or one of its dependencies.' ) should have made me click but I missed it.Basically the 32 Bit RegAsm could not find my DLL but the 64 bit RegAsm could find my file and by registering the assembly with the 64 bit RegAsm I was putting the DLL into 64 bit scope. I needed it to be in 32 Bit scope.I moved the DLL form System32 to SysWOW64 and the 32bit RegAsm found the DLL and registered it within the 32 Bit scope.Now my VB6 COM object can find the.Net DLL and it works with out the error 'ActiveX component can't create object'.With all that said, I have not found a library or function that will do the same job as RegAsm without actually using RegAsm.If anyone finds this mythical beast please reply to this question.
Thanks in advance. Hi jrich,The VB6 dll's are registered through regsrv32 and work just fine. They are attempting to call the.net library, which I register on my development machine without a hitch and in the following manner:C:Program FilesMicrosoft SDKsWindowsv7.0Abingacutil.exe /i C:WindowsSystem32.dllC:WindowsMicrosoft.NETFrameworkv2.0.50727RegAsm.exe C:WindowsSystem32.dll /tlb: C:WindowsSystem32.tlbThese same steps are not working on my testing environment. Diffrences include operating systems (dev: Windows 7 Enterprise, test: Windows Server 2008 R2) and x86 (dev) vs x64 (test).I have a feeling it has to do with the 64bit OS. I can run the 64bit RegAsm against the.net dll but the 32bit RegAsm errors out with 'RegAsm: error RA0000: Unable to locate input assembly 'C:WindowsSystem32xxxxx.dll' or one of its dependencies.' .Our live environment is currently a 32bit OS so I would not have an issue in live, but one day it will get upgraded and we will need a solution to this problem.Any help in this regard will be much appreciated.
Use Regasm From .bat Time
Hi,I found out that I was placing the.Net DLL in the incorrect folder on the test machine for registration.On a windows 64Bit OS you have the System32 and the SysWOW64 folders. I placed my DLL in the System32 folder, where it should have been in the SysWOW64 folder.The error I got from RegAsm ('RegAsm: error RA0000: Unable to locate input assembly 'C:WindowsSystem32xxxxx.dll' or one of its dependencies.'
) should have made me click but I missed it.Basically the 32 Bit RegAsm could not find my DLL but the 64 bit RegAsm could find my file and by registering the assembly with the 64 bit RegAsm I was putting the DLL into 64 bit scope. I needed it to be in 32 Bit scope.I moved the DLL form System32 to SysWOW64 and the 32bit RegAsm found the DLL and registered it within the 32 Bit scope.Now my VB6 COM object can find the.Net DLL and it works with out the error 'ActiveX component can't create object'.With all that said, I have not found a library or function that will do the same job as RegAsm without actually using RegAsm.If anyone finds this mythical beast please reply to this question. Thanks in advance. Well, I wont say that I have same problem as yours, but a similar problem.I created a C#.net dll (assembly) with the compiler build switch /platform: Any CPU. And then tried regasm it in the Windows Server 2008 64 bit R2. That went well, and then I gacutil -ed the same assembly. Now when I tried to create an Object in VBScript(Classic ASP web page), I get Active X object can't be created).
While the same stuff works fine n a Windows Vista Enterprise 32 bit.I dont suspect that this is something that's wrong with the COM, becauseI compiled the.net assembly as Any CPU and then tried to regasm it. Had I built the assebly as /platform: x86, then I would have agreed that I should have been using the SysWOW64; buthere I compiled the assembly as /platform: Any CPU.So I dont understand? Does it mean that a Microsoft COM is only meant to be 32 bit? And If I had to run a COM in 64 bit, it definitely had to be placed and registered for SysWoW64 (regardles of whether itis built for 64 bit or 32 bit platform)?Rest of the post workaround here:Please respond with anything that hits your knowledge, I might find it useful.- Thx.