开发者

Merge projects in solution into a single project?

I have a solution with a few projects. How开发者_Python百科 I can merge all projects into a single project? I want to just compile my solution and get single file application at the output.


Note: this question has been edited for clarity. Originally it was confusing and seemed to imply that it was looking for information on merging already-compiled assemblies.


I think you're looking for ILMerge.


You want to merge the projects, not just the assemblies?

I don't know any automated process, but I think you'll want to do something like:

  1. Create your "master" project.
  2. Look at the .NET and binary references (not project references) that other projects have. Add each of these references to the "master" project.
  3. Create a folder for each project that you want to merge into the master project.
  4. For each project, copy all files from that project to the corresponding folder in the master project. Make sure you give it the same BuildAction.
  5. Build! If the build fails, then you have more work to do.
  6. Remove the original projects from the solution.

Does every file in each project use its own namespace? If so, the above is all you have to do that I can think of. Otherwise, you'll want to make it so, recompile, and retest before trying to merge the projects into one.


(Answer based on old interpretation of question)

I am assuming you want to merge all of the resulting assemblies into a single one, and not the projects in to a single solution.

If that is the case, use ILMerge.

From the site:

ILMerge is a utility for merging multiple .NET assemblies into a single .NET assembly. It works on executables and DLLs alike and comes with several options for controlling the processing and format of the output. See the accompanying documentation for details.

This is not the only tool - you can also use Mono.Merge for the same functionality.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜