How can I run this line from within a C# console app?

  • Thread starter Thread starter Ronald S. Cook
  • Start date Start date
R

Ronald S. Cook

I have the following line that I wish to execute from within a C# Console
Application.

svcutil.exe http://localhost/COWFeedyardService/Services/Animal.svc
/out:Animal.vb /config:App.config

Manually, I can open the Windows SDK Command Prompt and type exactly the
above and it works. But how can I make it work from within a console app?

Thanks for any help,
Ron
 
Try code like:

Process proc = new Process();

proc.StartInfo.FileName = @"svcutil.exe";
proc.StartInfo.Arguments = @"http://localhost/COWFeedyardService/
Services/Animal.svc/out:Animal.vb /config:App.config";
proc.Start();

=====================
Clay Burch
Syncfusion, Inc.
 
That won't work as it is more than likely that the directory where
svcutil is not in the PATH environment variable.

Instead, the OP needs to specify the full path to svcutil.exe in the
arguments to the Process class. That's really the only thing that is
missing (which was pointed out in another thread to the OP as well, by
myself, and others).
 
Thanks Nicholas. I was just having some trouble with the syntax after all.

Ron

Nicholas Paldino said:
That won't work as it is more than likely that the directory where
svcutil is not in the PATH environment variable.

Instead, the OP needs to specify the full path to svcutil.exe in the
arguments to the Process class. That's really the only thing that is
missing (which was pointed out in another thread to the OP as well, by
myself, and others).

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

ClayB said:
Try code like:

Process proc = new Process();

proc.StartInfo.FileName = @"svcutil.exe";
proc.StartInfo.Arguments = @"http://localhost/COWFeedyardService/
Services/Animal.svc/out:Animal.vb /config:App.config";
proc.Start();

=====================
Clay Burch
Syncfusion, Inc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top