在 C# .NET 上创建的库的静态链接 [英] Static Linking of libraries created on C# .NET

查看:25
本文介绍了在 C# .NET 上创建的库的静态链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 VS2008 C#.NET.

I'm using VS2008 C#.NET.

我在 3 个项目中创建了 3 个不同类别的库.我编写了一个使用这些库(dll)的应用程序.

I created 3 different classes of libraries in 3 projects. I wrote an application which uses these libraries (dlls).

发生的事情是每个项目都编译成一个类库.所以,我有 3 个 dll 和 1 个 exe.

What is happening is each project is compiling into a class library. So, I've 3 dlls and 1 exe.

相反,我想通过两种方式获得这些:

Instead I want to have these in two ways:

  1. 只有包含其中 3 个和 1 个 exe 的类库程序集 (dll).
  2. 只有一个 EXE(里面的所有东西):: 静态链接.

我怎么能这样做?我在 VS2008 中找不到任何静态链接选项,也请提及命令行选项.

How could I do that? I cannot find any options for static linking in VS2008 also please mention commandline options too.

推荐答案

ILMerge 正是您所追求的.

我不确定我是否真的将其称为静态链接"——它只是将多个程序集合并为一个.(特别是,请不要以为这是在构建本机的、非托管的可执行文件.)但是,我认为这正是您所追求的 :)

I'm not sure I'd really call this "static linking" - it's just merging several assemblies into one. (In particular, please don't get the impression that this is building a native, unmanaged executable.) However, I think it's what you're after :)

更新:ILMerge 现在开源,也可作为NuGet 包:

Update: ILMerge is now open source and is also available as a NuGet package:

Install-Package ilmerge 

这篇关于在 C# .NET 上创建的库的静态链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆