Search code examples
.netcode-sharing

How to share classes between .NET projects without using a library?


I have two projects - one is a test one, other is the final version. I know there is a possibility to put shared code into a library, but I want that compiled result will be a single file, without any additional DLLs.


Solution

  • You can "link" a code file between two or more projects. Just Right click your project, choose Add -> Existing item, and then click the down arrow next to the Add button:

    In my experience linking is simpler than creating a library. Linked code results in a single executable with a single version.