How to prevent an abstract class with public derived classes from being inherited in other assemblies?

To make InternalData internal, DoProcess must be private or internal (or InternalAndProtected, but C# doesn't support this CLR feature). It can't be protected or protected internal.

internal abstract DoProcess(InternalData internalData);

I'd probably also add an internal abstract void DoNotInheritFromThisClassInAnOutsideAssembly() member. That prevents anybody outside the assembly from inheriting from your class, because they can't implement that member and they get a reasonable compiler error. But you can't make the Base class itself internal.


I'd consider refactoring the code, so that you have no common base class. Probably by using some internal interfaces and composition.