Results 1 to 1 of 1

Thread: Using Process to call Perl won't work with ClickOnce delployment

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    3

    Cool Using Process to call Perl won't work with ClickOnce delployment

    I have a VB.NET application that uses Process to call perl scripts to do telnet communication with remote machines. After I deploy it using ClickOnce, client machine can install and run the application but it seems the perl scripts won't work. (It works fine without using ClickOnce deployment) This function is called as child thread from main application. Not sure if this will impact.

    I have ensured to add the perl scripts to project and set their property to "content". And I did verify that those scripts are in the deployed file list. I call them from the same directory as application executable.

    Here is the code:


    Dim p As New Process
    Dim sr As StreamReader
    Dim sw As StreamWriter
    Dim psi As New ProcessStartInfo(PerlExePath)

    'Construct full path of the script called
    myRemoteScriptPath = AppPath & "\" & myRemoteScriptName

    psi.UseShellExecute = False 'Since we are redirecting to a stream this must be false
    psi.RedirectStandardInput = True 'True enables us to send commands through a stream
    psi.RedirectStandardOutput = True 'True enables us to capture data through a stream
    psi.CreateNoWindow = True 'Prevents a DOS box to appear when running.
    psi.Arguments = myRemoteScriptPath & " " & myRemoteIp 'Arguments to be used Perl Script Path & IPAddress

    p.StartInfo = psi 'Associate the Process to the Process Info Object
    p.Start() 'Start the Process: This runs the script
    sw = p.StandardInput 'Set the Stream Writer to the process standard input
    sr = p.StandardOutput 'Set the Stream reader to the process standard ouput
    sw.AutoFlush = True
    'System.Threading.Thread.Sleep(3000)
    sw.Flush() 'Force a flush of the stream
    sw.Close() 'Close the Sream Writer object prior to trying to read
    myCmdResponse = sr.ReadToEnd 'Read the entire Stream into a string variable


    Any help will be greatly appreciated.

    Jerry
    Last edited by jwang; Jul 28th, 2008 at 12:32 PM. Reason: added details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width