4

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.

Paul
  • 25,812
  • 38
  • 124
  • 247

3 Answers3

2

You can make use of ILMerge which will merge number of .Net assemblies to a single assembly.

Sriram Sakthivel
  • 72,067
  • 7
  • 111
  • 189
2

You should usually be able to add the same source code file to more than one project. In C#, for example, projects can contain links to files that are stored in other locations and that will be included in the compilation like any other files.

  • In Visual Studio 2012, for example, the selected answer to this question points out that you can drag files into a project while pressing the Alt key to create a link.
  • This article points out that a respective option is found in the Open file dialog when adding an existing file in some versions of Visual Studio.
  • In SharpDevelop 4, you can use Add -> Existing item from the project (or a project folder's) context menu to select an existing file to add to the project; if that file is outside of the folder hierarchy of your project; SharpDevelop will ask you whether you want to copy the file or just create a link to it.
Community
  • 1
  • 1
O. R. Mapper
  • 20,083
  • 9
  • 69
  • 114
1

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.

Thilina H
  • 5,754
  • 6
  • 26
  • 56