c# - Why can't I access my class through COM? -
I have class library which I have written in C # .net I want to register it with COM on my 64 bit window machine so that I can create an example of it in scripts using CreateObject () (javascript, vbscript, whatever). So I created a setup project. I have set the target of the Setup Project in platform x64, the target library of the class library project is set to any CPU, I have created a custom action for the installer, which manually registers the driver and it looks like this .. .
Registration Services regsrv = new RegistrationServices (); If (Regsrv.RegisterAssembly (this.GetType (.) Assembly, AssemblyRegistrationFlags.SetCodeBase) {New InstallException ("failed to register driver for COM interop"); }
I can add debugger to this process when it is running and it is certain that this registration starts successfully.
For some reason, when I used the CreateObject () object, the object of the class gives an error saying it could not "make the name with the error ...". However, if I run the script in the SysWOW64 folder (32 bit folder) using cscript.exe, then the object is created successfully and the rest of my script runs fine. So it appears that the class is being successfully registered for 32 bit, but not for 64, or that my project has 32 bit dependencies and the 64 bit CSScript host process can not make it due to that dependence. Class Library refers to another project I wrote but it is also ready for any CPU. Therefore it should be good for 32 and 64 bit processes.
Is anyone suggesting how should I track this 32bit dependency?
using register_assembled () very is unusual Wrong that the installer is running in 32-bit mode. Which registers will register the COM server in the wrong registry section.
There is no need to do this, just set the register property for the file in the setup project for COM.
Comments
Post a Comment