I want to split the components of my applications like:
Application A -> Component X <- Application B
without compiling Component X to a dll.
When I include the .cs, Visual Studio copies it to the application directory. I don’t want that. I want to include the file and then use a part of it, like C’s #define. For example if I have a ZIP library, I don’t want to include the whole assembly if I need a decompression. What’s the C# way to make this? Can I somehow tell VS to not copy the file and use #defines or maybe some method attributes?
Don’t create a problem where there isn’t any.
Create a new dll, and MOVE .cs files that should be shared there. Build it, and have AppA and AppB reference and use that dll.
BTW, you can add reference from AppA to AppB, or from AppB to AppA, but not at the same time because it will create circular reference.
And if you want to stick to your idea, LINK your code files as Chris suggested, and use:
To have pieces of code compile just in one application. Use project level #defines (project properties) to define APPA and APPB in their respective projects.