문제

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.

도움이 되었습니까?

해결책 3

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.

다른 팁

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

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.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top