开发者

Why can't .NET dlls be included with the app using "copy local" - so that installed .NET is not needed

Quite simple question, and I really wanna know the reason (the real reason) behind this. Say you want to distibute a .NET app to computers without .NET install开发者_运维技巧ed (not even 1.1). Why can't we just include mscorelib.dll & others with out app? Is it because CLR must be installed in some way, to gain JIT capabilities for intepreting IL?

I know this is quite meaningless question nowadays since every system has a minimum of .NET 2.0, but I still wonder :=)


Well, as you already said, the assemblies alone are useless.

You need the runtime environment, including the jitter, type loader, garbage collector etc.


.NET is a Just In Time interpretted langauge. Your assemblies don't compile down to a binary executable.

Therefore you need to have the .NET runtime installed so your code can be interpreted at runtime. Without it...your app isn't going to be doing much of anything.


Installing the libraries and the CLR also allows for shared assemblies. Do you really want hundreds of copies of the CLR running loose on your machine? I like the fact that I know certain things will be available for my application. Much better than having to worry about… Did I compile for 1.4.5 or 1.4.6 version of the runtime... maybe it was even 1.2.5 (JRE can be a pain)

Also there are many parts of the .Net Framework that are just managed wrappers over unmanaged APIs. As well as tons of other assemblies that you use but are not directly referenced. (see mscoree.tlb and many others)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜