[Mono-list] command line apps from ASP.NET

Chris Aitken chris at ion-dreams.com
Fri Jul 22 09:47:32 EDT 2005


Hi All,
I wrote the following:

using System;
using System.Diagnostics;

public class GACReader
{
        private static void Main()
        {
                System.Diagnostics.Process GACRead;

                GACRead = new System.Diagnostics.Process();
                GACRead.StartInfo.FileName = "gacutil";
                GACRead.StartInfo.Arguments = " -l | grep Version=1";
                GACRead.Start();

                GACRead.WaitForExit();
                GACRead.Close();
        }
}

It compiles fine, and outputs assemblies within the GAC, where Version=1*

So I wrote an ASP.NET page:

        System.Diagnostics.Process GACRead;

        GACRead = new System.Diagnostics.Process();
        GACRead.StartInfo.FileName = "/opt/mono/bin/gacutil";
        GACRead.StartInfo.Arguments = " -l | grep 'Version=1'";
        GACRead.StartInfo.UseShellExecute = false;
        GACRead.StartInfo.RedirectStandardOutput = true;
        GACRead.Start();

        contents = GACRead.StandardOutput.ReadToEnd();
	  lblGACOutput.Text = contents;

When: GACRead.StartInfo.Arguments = " -l"
It returns all the GAC listing.

But when: GACRead.StartInfo.Arguments = " -l | grep Version=1;
It returns nothing. Same result regardless of what is grep'd for.

Any ideas?

Thanks,

Chris


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Mono-list mailing list