elmowatson
Member
- Joined
- Jun 5, 2007
- Messages
- 17
- Programming Experience
- 1-3
I'm trying to run an app (GacUtil) which is normally run through a console window, directly in my winforms app, but I keep getting the error:
"The system cannot find the file specified"
Here is the code:
Dim AppName = "gacutil"
Dim BaseOptions = " /i"
Dim oStartInfo As New ProcessStartInfo
Dim sFull As String
Dim sStartPath As String = Path.GetDirectoryName(TextBox1.Text)
oStartInfo.WorkingDirectory = Path.GetDirectoryName(TextBox1.Text)
sFull = AppName & BaseOptions & " " & Path.GetFileName(TextBox1.Text)
oStartInfo.FileName = sfull
Process.Start(oStartInfo)
In this case, the DLL is in C:\, and 'GacUtil' has been added to the Environment path variable.
I can put a break point on the next to the last last line, copy and past the output of the 'sfull' variable into a command prompt and it will run perfectly. (I've tried adding oStartInfo.UseShellExecute=False, removing the whole workingDirectory property line and just changing sFull so that it has the Startpath also, but I still get the error)
However, when I try it in the Winforms app I'm creating, I get the error. Any ideas?
Process.Start(oStartInfo)
"The system cannot find the file specified"
Here is the code:
Dim AppName = "gacutil"
Dim BaseOptions = " /i"
Dim oStartInfo As New ProcessStartInfo
Dim sFull As String
Dim sStartPath As String = Path.GetDirectoryName(TextBox1.Text)
oStartInfo.WorkingDirectory = Path.GetDirectoryName(TextBox1.Text)
sFull = AppName & BaseOptions & " " & Path.GetFileName(TextBox1.Text)
oStartInfo.FileName = sfull
Process.Start(oStartInfo)
In this case, the DLL is in C:\, and 'GacUtil' has been added to the Environment path variable.
I can put a break point on the next to the last last line, copy and past the output of the 'sfull' variable into a command prompt and it will run perfectly. (I've tried adding oStartInfo.UseShellExecute=False, removing the whole workingDirectory property line and just changing sFull so that it has the Startpath also, but I still get the error)
However, when I try it in the Winforms app I'm creating, I get the error. Any ideas?
Process.Start(oStartInfo)
Last edited: