c# - Trying to Register package to COM -
i'm using regasm register .dll (derived .cs below) windows com. returns warning states there no type registered. thought because not of dependencies had default constructors; post-change same problem. question need define in classes explicitly stating used com object? if not, going wrong?
here minimal subset of 1 of classes (the main one):
public class almrest { //state: private string server; private string domain; private string project; private string username; private string password; // private string system; // private string assignedto; private string responsible; private string phase; private string testenv; // private string sid; //client/session state: private httpclient client; private cookiecontainer cookiejar; private httprequestheaders mainheaders; // private cookie lwssokey; private cookie qcsession; private cookie sessionkey; private cookie xsrftoken; private cookie almuser; //default\/ public almrest() { sid = environment.machinename; } public almrest(string[] authent, string sys, string[] tester) { server = authent[0]; domain = authent[1]; project = authent[2]; username = authent[3]; password = authent[4]; system = sys; assignedto = tester[0]; phase = tester[1]; testenv = tester[2]; responsible = username; schrodid = environment.machinename; startup(); } //for com/jni public void setup(string s, string d, string pr, string u, string p) { server = s; domain = d; project = pr; username = u; password = p; startup(); } private void startup() { //@todo(later): find out how derive ssl-cert https //handler.credentials = getsslcert(); cookiejar = new cookiecontainer(); httpclienthandler handler = new httpclienthandler(); handler.cookiecontainer = cookiejar; client = new httpclient(handler); client.baseaddress = new uri(server); mainheaders = client.defaultrequestheaders; //erase headers mainheaders.clear(); } //lots of methods (omitted) //delegates\/ problem? internal delegate entity factory(string entitiestype, params keyvaluepair<string, object>[] definition); internal delegate entities subtypequery(string subtypes, params keyvaluepair<string, object>[] values); internal delegate entity extractor(string field, object value, entities entities); internal delegate bool lockself(string id, string entitiestype); internal delegate bool unlockself(string id, string entitiestype); internal delegate bool deleteself(string id, string entitestype); internal delegate bool ammendproperty(string id, string entitiestype, params keyvaluepair<string, object>[] ammendments); internal delegate list<delegate> inheritor(); } now, methods call object-model defined , of classes have default constructors too. more information need please let me know, left out methods because there on 20 of them. thanks.
i think problem in class. according example com class msdn. class must follow rules com visible:
exposing visual c# objects com requires declaring class interface, events interface if required, , class itself. class members must follow these rules visible com: + class must public.
- properties, methods, , events must public.
- properties , methods must declared on class interface.
- events must declared in event interface.
other public members in class not declared in these interfaces not visible com, visible other .net framework objects.
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/interop/example-com-class
Comments
Post a Comment