Reputation: 21
I'm trying to run a .NET Application built in Debug mode via PHP.
PHP runs other applications successfully.
The problem is when I run this application via Windows Explorer (i.e. by typing "C:\app.exe arguments" in the address bar), it works absolutely fine.
But, when I run the same with EITHER PHP or CMD.exe (Command Prompt), the application crashes. I looked at the generated metadata file in temp folder(s) and it had a FileNotFound IO Exception.
Any clues?
Looks like some notorious directory problem (working path, etc.)
Please help, Thanks.
Upvotes: 0
Views: 165
Reputation: 124746
Looks like some notorious directory problem
Yes it sounds like an application bug - probably the application is making assumptions about the current working directory which aren't always true. Possibly it's assuming the current working directory (Environment.CurrentDirectory
) is the same as the application's installation directory (AppDomain.CurrentDomain.BaseDirectory
).
This assumption will probably be true when running the app from Windows explorer, but not necessarily in the general case.
To access files stored in a folder relative to the install directory, replace Environment.CurrentDirectory
by AppDomain.CurrentDomain.BaseDirectory
.
Upvotes: 1