链接器的.NET应用程序的状态(又名"请主席先生,我有一个链接器" 2009年版)链接、又名、我有一个、应用程序

2023-09-02 21:08:45 作者:控制欲 Callous

这里很多人可能熟悉乔尔斯波斯基中最流行的博客文章的请先生,我可以有一个链接,他急切需要一种方式来消除对这样一个独立的应用程序可以被开发的.NET框架的依赖性和卖了。

Many people here are probably familiar with one of Joel Spolsky most popular blog posts, Please Sir, May I Have a Linker, where he cries out for a way to remove dependencies on the .NET framework so a stand-alone application can be developed and sold.

贾森·詹德,在当时,回答的与他的话题的看法,他们认为该主题是有点无实际意义 - 修复在运行时的安全问题的能力(中其他分)是他们首要关注的问题。总体而言,小的开销是值得的。

Jason Zander of the Visual Studio development team, at the time, replied with his views on the topic, arguing that the topic is somewhat moot - the ability to fix security problems in the runtime (among other points) was their chief concern. Overall, the small overhead was worth it.

快进到2009年有几组那里现在自称拥有C#的接头。 (贾森·詹德甚至说自己,这不会花费太多来实现的。)的.NET 1.0的可爱,打,所以MEG下载相反,我们现在有一个巨大的200-300万桶跨平台的完整的.NET 3.5的安装程序它包含.NET的用于x86,x64和IA64版本。微软的建议,以减少运行时的尺寸包括:

Fast forward to 2009. There's a few groups out there now claiming to have C# linkers. (Jason Zander even said himself that it wouldn't take much to implement one.) Instead of the cute, dozen-so meg download of .NET 1.0, we now have a massive 200-300 mb cross-platform complete .NET 3.5 installer that contains versions of .NET for x86, x64, and ia64. Microsoft's suggestions to decrease the runtime size include:

解压缩再发行,删除不想要的目标平台,并把它重新走到一起 使用Web引导程序,只有下载库平台 使用客户端配置文件安装程序(新截至2008年底),这限制了图书馆,仅适用于86

更糟糕的是,据我所知(请纠正我,如果我错了)的客户端配置文件甚至不与Windows注册为具有.NET 3.5安装。这意味着,如果多个.NET 3.5的客户端应用程序安装在计算机上,没有人会看到对方和运行时会被一次又一次地重新安装!

To make matters worse, as I understand it (please correct me if I'm wrong) the client profile don't even register with windows as having .NET 3.5 installed. This means if multiple .NET 3.5 client applications are installed on the computer, none will see each other and the runtime will be re-installed again and again!

我真的不知道微软是想在这里。即使假设最坏的情况下安装将是一个目标平台(例如,64位),只有那些库需要被包括在内,你还在寻找向上的60 MB的开销您的应用程序。即使是其中最知名的.NET应用程序,Paint.NET,充满了Difficulties因为安装了大量的.NET依赖的应用程序。的,如果他们分发免费的应用程序,对世界其他国家有什么问题?最后,他们不得不做一个引导程序的安装了Microsoft安装程序3.1,.NET运行时引导程序,以及他们的所有其他相关的libraires 的,才可以安装自己的应用程序。

I really don't know what Microsoft is thinking here. Even assuming the worst case install will be for one target platform (eg, x64) and only those libraries need to be included, you're still looking at upwards of 60 mb overhead on your app. Even one of the most well known .NET apps, Paint.NET, was fraught with Difficulties installing the application because of the massive .NET dependencies. If THEY have problems distributing a free app, what about the rest of the world? In the end, they had to Make a bootstrapper that installed Microsoft Installer 3.1, the .NET runtime bootstrapper, and all their other dependent libraires before they could install their own application.

那么怎么样了。链接器。是否有任何好的存在 - 还是一个工具,它只是使人们有可能建立一个C#应用程序,而无需用户安装了大量的.NET运行库

So how about it. A linker. Do any good ones exist - or a tool that simply makes it possible to build a C# application without requiring that the user install the massive .NET runtime?

更新:所以,它看起来像有一对夫妇的选择:

Update: so, it looks like there's a couple of options:

单声道:

单声道都有自己的连接器。从下面的答案,它看起来像它的工作原理pretty的好。 Mono has its own linker. From the answer below, it looks like it works pretty well.

.NET:

异种code 似乎是一个可用,并且作品。 Thinstall 是另一种被推荐的,这是由VMware。 还有一个链接器Remotesoft 。他们法案它作为一个模糊处理。有什么想法呢? 由Rustemsoft找到另一个叫滑板。NET混淆器。任何人都熟悉他们? ILmerge微软还建议;这看起来像只完成了任务的一部分(即合并库,不剥出未使用的位)。 Xenocode seems to be one that's available and works. Thinstall is another that was recommended, and it's by VMware. There's another linker by Remotesoft. They bill it as an 'obfuscator'. Any thoughts there? Found another by Rustemsoft called Skater .NET Obfuscator. Anyone familiar with them? ILmerge by Microsoft was also suggested; this looks like it only performs part of the task (ie, merging libraries, not stripping out unused bits).

它看起来像Mono的工具越来越使用;如何对基于.NET的工具?其他任何与他们的经验,还是仅仅将不得不等待微软推3.5给大家?我不敢想像它会花多久的.NET 4.0被放出来......

It looks like the Mono tools are getting use; how about the .NET based tools? Any other experience with them, or are we just going to have to wait for Microsoft to push it 3.5 out to everyone? I shudder to think how long it'll take for .NET 4.0 to be put out...

推荐答案

在单链接。

我不能谈论太多关于其他软件此处列出,但作为单声道连接器的作者,我可以告诉它做什么,什么不。

I can't talk much about the other pieces of software that are listed here, but as the author of the Mono Linker, I can tell what it does and what it does not.

Mono的链接器只是一个管理的连接器,因此按照定义,它需要集,并删除什么是没有必要的程序来运行。它不会合并组件都在一起,而且它不会使本机程序了出来。

The Mono Linker is only a managed linker, so by definition, it takes assemblies, and removes what's not necessary for a program to run. It doesn't merge assemblies all together, and it doesn't make a native program out of them.

有ILMerge的Mono.Merge克隆,但它不是完整的,它的作者是不是维护它。要生成含有的单声道运行时和组件本机程序,Mono提供了 mkbundle工具

There's a Mono.Merge clone of ILMerge, but it's not complete, and its author is not maintaining it. To generate a native program containing both the Mono runtime and assemblies, Mono provides the mkbundle tool.

此外,因为它只是一个管理工具,它改变组件,如果你给它强命名程序集,并且您没有私钥签名他们回来,你必须运行这些组件的麻烦。

Also, as it is only a managed tool, which is altering assemblies, if you give it strong named assemblies, and that you don't have the private keys to sign them back, you'll have troubles running those assemblies.

我写了一对夫妇的博客文章有关链接:

I wrote a couple of blog posts about the linker:

连接器的presentation 一个组合使用的连接器和mkbundle A presentation of the linker A combined used of the linker and mkbundle

关于我们与连接器的经验。链接器在Mono项目两部分组成目前使用的。它用于生成散发的人嵌入我们的C#编译器,Mono.CSharp.dll大会。你可以看米格尔的presentation 在PDC,这说明我们是如何做到这一点。这是pretty的简单,它的链接,这是一个可定制的工具的基本用法,这是pretty的容易编写自定义的步骤吧。

About our experience with the Linker. The Linker is currently used in two parts of the Mono project. It's used to generate the assembly that we distribute for people to embed our C# compiler, Mono.CSharp.dll. You can watch Miguel's presentation at the PDC, which describes how we do that. It's pretty straightforward, and it's a basic usage of the Linker, which is a customizable tool, and it's pretty easy to write custom steps for it.

一个更复杂的使用链接器的是我们创建了月光组件的。月光是我们实施的Silverlight,该组件是桌面组件的一个子集。因此,我们连接我们的桌面组件,以减少它们的大小,并使用自定义的步骤,我们正在改变公共API相匹配的Silverlight的。

A more complex use of the Linker is the way we create our Moonlight assemblies. Moonlight being our implementation of Silverlight, the assemblies are a subset of the desktop assemblies. So we link our desktop assemblies to reduce their sizes, and using custom steps, we're transforming the public API to match Silverlight's.

所以呀,链接器有一定的pretty的粗糙的边缘,如命令行界面,例如,或者说,你要真的知道自己在做什么,或者你可能会得到一些奇怪的组件的事实,但所有的一切,它的作品真的很适合我们。

So yeah, the Linker has some pretty rough edges, such as the command line interface for instance, or the fact that you have to really know what you're doing, or you may end up with some weird assemblies, but all in all, it works really well for us.