Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > vbc vommand line compiler verbose messages

Reply
Thread Tools

vbc vommand line compiler verbose messages

 
 
Sam
Guest
Posts: n/a
 
      11-11-2003
Does anyone know how I can call vbc.exe from a Windows Application and
return the output messages?

I thought I might be able to do it using the
System.Diagnostics.Process object. I have got it executing correctly
and I am able to perform builds using this object, however cannot get
feedback to my Windows Application by way of verbose messages to
verify the build was successful.

I have attempted to append a pipe style argument to the end of the
arguments I pass into the Process object, however they cause the
process to fail. I assume it is because vbc.exe does not recognise a
piped command as an argument for itself, even though the same
arguments used directly in a command window execute correctly.

I am thinking of the piped command to file argument to allow me to
monitor the file for changes and dynamically display it in my Windows
Application. If there is a better way that someone knows about then I
would love to hear about it.

<SampleCode>
Dim compile As System.Diagnostics.Process

' Create new Process object
compile = New System.Diagnostics.Process()
With compile
.StartInfo.FileName =
"C:\Windows\Microsoft.NET\Framework\v1.0.3705\vbc. exe"
.StartInfo.Arguments = "/out:bin/MyDll.dll /t:library /verbose
Test.vb > c:\VerboseOutput.txt"
.Start()
.Close()
End With
</SampleCode>

Thoughts? Comments?

Thanks,

Sam.
 
Reply With Quote
 
 
 
 
Natty Gur
Guest
Posts: n/a
 
      11-11-2003
Hi,

1) you can use WaitForExit and ExitCode to get indication.
2) RedirectStandardOutput and StandardOutput.ReadToEnd should return the
string (I never tried them!)

sample code :

private bool StartAppWithArguments(string args,string FileName)
{
try
{

System.Diagnostics.Process myproc;
myproc = new System.Diagnostics.Process();

myproc.StartInfo.FileName = FileName;
myproc.StartInfo.Arguments = args;
//myproc.StartInfo.RedirectStandardOutput = true;
myproc.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden ;
myproc.EnableRaisingEvents = true;



myproc.Start();
myproc.WaitForExit();
if( myproc.ExitCode == 0)
{
//string strRes = myproc.StandardOutput.ReadToEnd () ;
return true;
}
return false;
}
catch(Exception Err)
{
}

}

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Todd Acheson
Guest
Posts: n/a
 
      12-02-2003
You can redirect the compiler output to a text file:

Example; output to FileName.txt:
vbc.exe (all your switches, etc) >>FileName.txt

Include the ">>" in your statement

Another Example:
vbc.exe /t:library /out:C:\MyPath\MyAssembly.dll
/reference:System.dll,System.Data.dll MyAssemblyCode.vb >>CompilerOutput.txt

I would probably create a BAT file and launch it with CMD.EXE, making sure
that the reference to vbc.exe is in my PATH variable. I do this all the
time when i build new releases of our software.
Using the System.Diagnostics.Process like you indicated is good. If you
want the window to be hidden, add to your WITH statement:
..StartInfo.WindowStyle = ProcessWindowStyle.Hidden

Good luck,

Todd A.



"Sam" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Does anyone know how I can call vbc.exe from a Windows Application and
> return the output messages?
>
> I thought I might be able to do it using the
> System.Diagnostics.Process object. I have got it executing correctly
> and I am able to perform builds using this object, however cannot get
> feedback to my Windows Application by way of verbose messages to
> verify the build was successful.
>
> I have attempted to append a pipe style argument to the end of the
> arguments I pass into the Process object, however they cause the
> process to fail. I assume it is because vbc.exe does not recognise a
> piped command as an argument for itself, even though the same
> arguments used directly in a command window execute correctly.
>
> I am thinking of the piped command to file argument to allow me to
> monitor the file for changes and dynamically display it in my Windows
> Application. If there is a better way that someone knows about then I
> would love to hear about it.
>
> <SampleCode>
> Dim compile As System.Diagnostics.Process
>
> ' Create new Process object
> compile = New System.Diagnostics.Process()
> With compile
> .StartInfo.FileName =
> "C:\Windows\Microsoft.NET\Framework\v1.0.3705\vbc. exe"
> .StartInfo.Arguments = "/out:bin/MyDll.dll /t:library /verbose
> Test.vb > c:\VerboseOutput.txt"
> .Start()
> .Close()
> End With
> </SampleCode>
>
> Thoughts? Comments?
>
> Thanks,
>
> Sam.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vbc compiler error code 1 Mark Carrington ASP .Net 7 03-06-2007 08:16 AM
HTTPConnection - verbose error messages guyzdancin Java 2 01-13-2006 05:02 PM
HTTPConnection - verbose error messages guyzdancin Java 0 01-11-2006 08:08 PM
Compile asp.net VBNet using vbc.exe command line error Dave Willock ASP .Net 1 01-10-2004 11:50 PM
vbc.exe neo ASP .Net 2 12-11-2003 07:18 PM



Advertisments