Click here to Skip to main content
15,914,163 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dll Output Pin
Giorgi Dalakishvili4-Jan-08 1:09
mentorGiorgi Dalakishvili4-Jan-08 1:09 
GeneralRe: Dll Output Pin
Xmen Real 4-Jan-08 1:52
professional Xmen Real 4-Jan-08 1:52 
Questioncsv import truncates to 255 characters Pin
Krikke474-Jan-08 0:57
Krikke474-Jan-08 0:57 
GeneralRe: csv import truncates to 255 characters Pin
Skippums4-Jan-08 4:16
Skippums4-Jan-08 4:16 
GeneralRe: csv import truncates to 255 characters Pin
Dave Kreskowiak4-Jan-08 5:14
mveDave Kreskowiak4-Jan-08 5:14 
QuestionAdd WebReference at Runtime? Pin
Pankaj - Joshi4-Jan-08 0:15
Pankaj - Joshi4-Jan-08 0:15 
AnswerRe: Add WebReference at Runtime? Pin
originSH4-Jan-08 1:15
originSH4-Jan-08 1:15 
GeneralNgen on setup, VB to C# translation Pin
Bekjong3-Jan-08 23:00
Bekjong3-Jan-08 23:00 
Hi all,

I was looking for a way to Ngen my program on the target system at setup. I found an example on MSDN[^] in Visual Basic. Although I don't know anything about VB, translation usually isn't too hard, but this time I'm finding it difficult.

If anyone could lend me a hand at this that would be great. This is the code concerned:

Private Declare Function GetCORSystemDirectory Lib "mscoree.dll" _
  (<runtime.interopservices.marshalas( _<br="" mode="hold" />  System.Runtime.InteropServices.UnmanagedType.LPWStr)> _
  ByVal Buffer As System.Text.StringBuilder, _
  ByVal BufferLength As Integer, ByRef Length As Integer) As Integer

<security.permissions.securitypermission(security.permissions.securityaction.demand)> _
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
</security.permissions.securitypermission(security.permissions.securityaction.demand)>


Might be best to check out the code from the MSDN example though, since it provides the proper context. Thanks in advance!


Standards are great! Everybody should have one!

GeneralRe: Ngen on setup, VB to C# translation Pin
Declan Bright3-Jan-08 23:22
Declan Bright3-Jan-08 23:22 
GeneralRe: Ngen on setup, VB to C# translation Pin
Bekjong3-Jan-08 23:29
Bekjong3-Jan-08 23:29 
GeneralRe: Ngen on setup, VB to C# translation Pin
Giorgi Dalakishvili3-Jan-08 23:35
mentorGiorgi Dalakishvili3-Jan-08 23:35 
General[Message Deleted] Pin
Bekjong4-Jan-08 0:03
Bekjong4-Jan-08 0:03 
GeneralRe: Ngen on setup, VB to C# translation Pin
Giorgi Dalakishvili4-Jan-08 0:16
mentorGiorgi Dalakishvili4-Jan-08 0:16 
GeneralRe: Ngen on setup, VB to C# translation Pin
Bekjong4-Jan-08 0:18
Bekjong4-Jan-08 0:18 
GeneralRe: Ngen on setup, VB to C# translation Pin
Bekjong4-Jan-08 0:14
Bekjong4-Jan-08 0:14 
GeneralRe: Ngen on setup, VB to C# translation Pin
Giorgi Dalakishvili4-Jan-08 0:28
mentorGiorgi Dalakishvili4-Jan-08 0:28 
GeneralRe: Ngen on setup, VB to C# translation Pin
Bekjong4-Jan-08 1:36
Bekjong4-Jan-08 1:36 
GeneralRe: Ngen on setup, VB to C# translation Pin
Giorgi Dalakishvili4-Jan-08 1:49
mentorGiorgi Dalakishvili4-Jan-08 1:49 
GeneralRe: Ngen on setup, VB to C# translation Pin
Bekjong4-Jan-08 2:03
Bekjong4-Jan-08 2:03 
GeneralRe: Ngen on setup, VB to C# translation Pin
Giorgi Dalakishvili4-Jan-08 2:14
mentorGiorgi Dalakishvili4-Jan-08 2:14 
AnswerRe: Ngen on setup, VB to C# translation Pin
Bekjong4-Jan-08 2:20
Bekjong4-Jan-08 2:20 
GeneralRe: Ngen on setup, VB to C# translation Pin
Giorgi Dalakishvili4-Jan-08 2:21
mentorGiorgi Dalakishvili4-Jan-08 2:21 
Generalwriting dataset to xml Pin
cellardoor07163-Jan-08 22:54
cellardoor07163-Jan-08 22:54 
QuestionLoading Text into a RichTextBox (With a catch) Pin
Programm3r3-Jan-08 22:52
Programm3r3-Jan-08 22:52 
GeneralRe: Loading Text into a RichTextBox (With a catch) Pin
Giorgi Dalakishvili3-Jan-08 23:05
mentorGiorgi Dalakishvili3-Jan-08 23:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.