Search code examples
c#.netopc-uaopc

OPC Server issue with loading XML page with LoadPredefinedNodes


I'm currently working on a C# project where I want to develop my own OPC server application that I can configure with XML. I already compiled a custom XML object with the UA-ModelCompiler repo.

I used the Boiler example from the UA-.NETStandard-Samples repo. I added some custom objects for an agv and I want to integrate it with my own NodeManager. I copied the BoilerNodeManager and modified it for an agv. The following method always has an error.

protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
    NodeStateCollection predefinedNodes = new NodeStateCollection();
    predefinedNodes.LoadFromBinaryResource(context, "Opc.Ua.Sample.Agv.Agv.PredefinedNodes.uanodes", this.GetType().GetTypeInfo().Assembly, true);

    return predefinedNodes;
}

With this error message:

Dutch error message

When I use the full path everything works, but with the embedded resource file it won't.

I think I forgot something, but I don’t now what.


Solution

  • I forgot to add the EmbeddedResouce path within Opc.Ua.Sample.csproj.

    <ItemGroup
        <EmbeddedResource Include="TestData\TestData.PredefinedNodes.uanodes;MemoryBuffer\MemoryBuffer.PredefinedNodes.uanodes;Boiler\Boiler.PredefinedNodes.uanodes;Agv\Agv.PredefinedNodes.uanodes" />
    </ItemGroup>