I have a C# library with lots of internal functionality exposing only a few public classes and interfaces. I would like to share this code between several projects, and each project may need to extend the internal classes with subclasses.
I don't like the idea of making all these classes public in order to create a common library. I think it exposes them too much to easy decompilation and break the design.
Is the only real option to create a copy of the source code and keep those files in sync between projects? Or is there some way I can share code and still get a single library for each project exposing only the few intended public interfaces and classes?
I'm using Visual Studio 2010.
UPDATE
Thanks for the clarification regarding decompilation and "private" access. I think I could consider applying an obfuscator over several input libraries, all together, hopefully obfuscating even their public connections.
From the design standpoint, seems like the answer is definitively to use friend assemblies.
You may want to look at doing friend assemblies:
http://msdn.microsoft.com/en-us/library/0tke9fxk(v=vs.80).aspx
[assembly:InternalsVisibleTo("someassembly")]