[email protected]  具体的问

解决方案 »

  1.   

    基本上对应翻译一下就可以了吧?Imports System.Runtime.InteropServices
    Imports System.Textusing System.Runtime.InteropServices;
    using System.Text;---------------------Private Declare Function GetCORSystemDirectory Lib "mscoree.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal Buffer As System.Text.StringBuilder, ByVal BufferLength As Integer, ByRef Length As Integer) As Integer[DllImport("mscoree.dll")]
    int GetCORSystemDirectory([MarsalAs(...)] System.Text.StringBuilder Buffer, ...);----------------------Public Overrides Sub Install(ByVal savedState As System.Collections.IDictionary)
       MyBase.Install(savedState)
       Dim Args As String = Me.Context.Parameters.Item("Args")   If Args = "" Then
          Throw New InstallException("No arguments specified")
       End If   ' Gets the path to the Framework directory.
       Dim Path As New System.Text.StringBuilder(1024)
       Dim Size As Integer
       GetCORSystemDirectory(Path, Path.Capacity, Size)   Dim P As Process
       ' Quotes the arguments, in case they have a space in them.
       Dim Si As New ProcessStartInfo(Path.ToString() & "ngen.exe", Chr(34) & Args & Chr(34))
       Si.WindowStyle = ProcessWindowStyle.Hidden 
       Try
          P = Process.Start(Si)
          P.WaitForExit()
       Catch e As Exception
          Throw New InstallException(e.Message)
       End Try
    End Sub
    public virtual void Install(...)
    {
       base.Install(...);
       string Args = Me.Context....   if(...)
       {
           throw new ....
       }   System.Text.StringBuilder Path = new System.Text.StringBuilder(1024);
       int Size;   GetCORSystemDirectory(...)   Process P;
       ProcessStartInfo Si = new ProcessStartInfo(... + "ngen.exe", "\"" + Args + "\"");   try
       {
          P = Process.Start(Si);
          ...
       }
       catch(Exception e)
       {
          throw...
       }
    }
      

  2.   

    直接告诉我ngen.exe的实际用法吧,我用了N次都不见效比如我的工程的目录是c:\1
      生成的Release版程序是在c:\1\bin\Release\1.exe
    那么我怎样用ngen.exe把它搞成本地代码.给一条完整命令给我就OK了.
    谢谢 sumtec
      

  3.   

    ngen [参数] <程序集的名称或者显示的名称>管理参数:
    /show 显示已经安装到缓冲里面的程序集列表
    /delete 从缓冲当中删除指定的程序集
    /showversion 显示用来产生程序集的本地代码的编译器(框架)版本号开发者参数:
    ... 这个你似乎用不着杂项参数:
    /?  不用解释吧?
    /nologo 不显示logo
    /silent 安静模式
      

  4.   

    c:\winnt\microsoft.net\v1.1.4322\ngen "c:\1\bin\Release\1.exe"这样仅仅生成1.exe的本机映像,如果通过一句话生成包括1.exe引用的所有dll的本机映像,请参见Alt-H、I、Ngen
      

  5.   

    我用的就这利方式,看来带过多.NET类应用的程序即使本地化了,也不能快多少,谢谢