I have two projects, Server and ServerCOMInterop. I have defined some classes in the Server project and I have imported them in ServerCOMInterop. Now I want to create a COMInterface for the ServerCOMInterop but the classes from Server are not available when using the interface.
Just to make this more clear, here is some code:
// This is in the Server project
namespace Server {
[Guid("5c2f4d41-9b23-435b-8245-b180eb350a26")]
[ComVisible(true)]
public class Point {
public int X;
public int Y;
}
}
// This is in the server-com-interop-project
using Server;
namespace ServerCOMInterop {
// This class and its methods show up just fine, ...
[Guid("43dbba1c-5bb5-4df0-87f1-5f3bf9729482")]
[ComVisible(true)]
public class Operations {
...
// but the Point type does not
public int LengthSquared(Point point) {
return point.X * point.X + point.Y * point.Y;
}
...
}
}
In case this is relevant, I am using .Net Framework 4.5 and trying to use the COM interface from VB6.
I would have expected the Point type to be available just like e.g. the Operations class; however trying to create a new Point from VB6 or determining the type of point when it is returned / expected as a parameter fails both when running the code and when using code completion.
I have tried setting "Register for COM-Interop" on the Server-project to true aswell, but this did not have any effects.
Are there any other things I need to do to be able to access Point through COM or is sharing a type from another project through COM simply not possible?
public int LengthSquared(Server.Point point)? And of course also referencing Server in the VB project.