请问怎么实现C#的静态编译?

nasty 2003-06-08 12:18:08
请问怎么实现C#的静态编译?
...全文
647 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
韩磊 2003-06-08
  • 打赏
  • 举报
回复
再说两句。如非必要,不要采用预编译,它将会影响执行速度。.NET Framework本身是预编译的。预编译对应用程序的启动有加速作用,但执行速度要快,最好还是用JIT。
韩磊 2003-06-08
  • 打赏
  • 举报
回复
.NET执行方式一般采用Just-In-Time编译,但你也可以预编译。用这个——

ngen MyApp.exe

ngen.exe位于Framework相应版本目录下。如c:\WINNT\Microsoft.NET\Framework\v1.0.2914

这个命令行程序有许多用处。除了预编译应用程序,还可以用来列出所有预编译过的程序(用 /show参数)。详见下面:

Microsoft (R) CLR Native Image Generator - Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Usage: ngen [options] <assembly path or display name> ...

Administrative options:
/show Show existing native images (show all if no args)
/delete Delete an existing native image (use * to delete all)
/showversion Displays the version of the runtime that would be used
to generate the image (it does not actually create the
image)

Developer options:
/debug Generate image which can be used under a debugger
/debugopt Generate image which can be used under
a debugger in optimized debugging mode
/prof Generate image which can be used under a profiler

Miscellaneous options:
/? or /help Show this message
/nologo Prevents displaying of logo
/silent Prevents displaying of success messages
szwebnet 2003-06-08
  • 打赏
  • 举报
回复
install Microsoft .NET Framework SDK
or vs.net

use "csc.exe" /... command
shuker 2003-06-08
  • 打赏
  • 举报
回复
我觉得是没有办法做到的
不知道高手有没有什么办法

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧