01/29/2024
Hello,
I have downloaded the OPC NET API assemblies (https://opcfoundation.org/deve.....urce-code/) and built them using Visual Studio. I had to change the target framework to 4.8, as the original targeted one is not installed on my PC, but I did not make any other changes to the Visual Studio project.
The problem arises after I paste them into the GAC and use the command "regasm.exe" (from C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe) for the DLLs (OpcNetApi.Com.dll, OpcNetApi.dll, OpcNetApi.Xml.dll, and OpcComRcw.dll). When I try to run the following code:
using Opc.Da;
public class OpcServerList
{
public void ListServers()
{
ServerEnumerator enumerator = new ServerEnumerator();
Opc.Server[] servers = enumerator.GetAvailableServers(Specification.COM_DA_20);
}
}
I encounter the following exception:
System.Runtime.InteropServices.ExternalException: CoCreateInstanceEx: Class not registered
It's worth noting that when using a third-party installer for the OPC NET API assemblies, everything runs smoothly. This leads me to suspect that I am missing a step when registering the DLLs. Could you please help me? I've been stuck on this issue for several days now.
P.S.: The code is actually executed in LabVIEW, so the C# code shown above is a direct transcription of the LabVIEW code I am using.
Thank you very much
Michael
1 Guest(s)