Hi,
I started a new C# Class library project, and added an exe (.NET 3.5 with custom components) file as reference, also added other dll files used by that exe, i noticed that not all classes within that exe file are visible, i would have prefered to import a dll, but that's the requirements so its' not an option, also i'm sure these classes/members are public and normally accessible within the exe's code.

Any ideas?

Recommended Answers

All 12 Replies

I've exposed objects from an EXE before and not had this problem. Can you attach one of the smaller file objects that is not properly exposing itself to modules referencing the EXE?

Also, have you verified the object that is not getting exposed is using the namespace you are expecting?

Something else to check: if trying to access a static method, it needs to be proceeded by the class name: TheClassName.MethodName()

Hi,
Thanks for your reply
unfortunately cannot provide an EXE
I have verified that the non exposed members are in the correct namespace, also that same namespace has other classes that are normally accessible,
also note that one these accessible classes is a child of another unexposed class.

I'll try building a skeleton project reproducing the problem, and attach it later

also note that one these accessible classes is a child of another unexposed class.

Are you saying that you are trying to access a class that is inside of another class that is not exposed? Because that sort of explains the problem. To expose the "child class definition", you could move that outside of the unexposed class.

If that's not the problem and I have misunderstood, try using the fully qualified name: namespace.class.member , build and submit the complete error text generated.

Are you saying that you are trying to access a class that is inside of another class that is not exposed? Because that sort of explains the problem. To expose the "child class definition", you could move that outside of the unexposed class.

If that's not the problem and I have misunderstood, try using the fully qualified name: namespace.class.member , build and submit the complete error text generated.

You misunderstood it, maybe i used a wrong naming, actually the exposed class inherits from another class, in the same namespace, that is not currently exposed, and the inherited properties are also missing.

here's the error when using the fully qualified name

Error	1	The type or namespace name 'X' does not exist in the namespace 'A.B' (are you missing an assembly reference?)

Do you have all the needed references added to the your assembly inherited by the class? When you say the inherited class is not exposed, do you mean by definition, or that you just can't see it when trying to use it?

Here are a couple of other things to check/try:
- if the EXE you are referencing is also in your solution, make sure it built without errors.
- if it built OK, try deleting the reference to it in the module that won't build, then add the reference again. I've seen this problem before.

Open up the access modifiers for the class then. You obviously want to use the base class outside of the .exe assembly because you're trying to access a derived class. Change the access modifiers to public and you should be good to go.

Also -- This is all managed code we're talking about, right? You're not doing any COM calls?

Hi,
I don't have access to the exe code to change it or debug it, but i asked the developers and the classes in question are all public, and are all in the same namespace as the class that i can access already, so it's not a direct reference issue, from what i've seen so far, however i'm now trying to find if there are some extra external references that i missed.

Thanks again

You can reference to dll-assemblies, not exe. So your C# must be in Class library or Control library assembly.

Please mark this thread as solved if there is nothing else we can do for you ... and it doesn't sound like there is :)

Good luck!

I found the problem,
an interface used is not declared as public, instead the declaration is interface X , i changed it to public and now everything seems to be working for now
Thank you for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.