1
I have a Console Application that needs to call an application.
Since I won’t be sure where it was installed, I need to assign the value to the path variable as below to get the application installation location.
string path = System.AppDomain.CurrentDomain.BaseDirectory + "IASD.ASCS.WPF.exe";
Now when I pass the parameter to open the application, the Application Console does not open the application.
Processe.Start (path);
No error message is displayed. Only does not load the executable.
How to call this application when I don’t know where the executable was installed?
How does the
path
resultant?– Leonel Sanches da Silva
It is recommended to concatenate paths using
Path.Combine
thus:Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "IASD.ASCS.WPF.exe")
– Miguel Angelo
They are inside a Try block catch, because if there is will give an error of
O sistema não pode encontrar o arquivo especificado
. To call this you have to pass the actual application path, or else add thepath
in windows environment variables, because, if you type like thisProcesse.Start ("calc.exe")
it will open the calculator different from your system because it does not know the way... TheSystem.AppDomain.CurrentDomain.BaseDirectory
is referring to the execution path of your console application, and there should not have the executable that you seek– user6026