|
I have two C# .NET applications, AppA (located in folder A) and AppB (located in folder B). AppB is also using a lot of 3rd party dll:s and configuration files located in folder B. If I start AppB from folder B the application is working as expected.
The problem is when I start appB from appA using Process.Start(), and Process.StartInfo.FileName is pointing to appB. AppB is now starting up, but it seems like it is trying to load resources from folder A instead of folder B. How can I solve this? appB shall always load resources and dll:s from folder B.
modified 21-Jan-13 8:08am.
|
|
|
|
|
Have you tried setting the WorkingDirectory property of ProcessStartInfo?
|
|
|
|
|
Yes but is is still not working.
From AppB i print System.IO.Directory.GetCurrentWorkingDirectory() and that path is alright. I Also print all loaded dll:s and when AppB is started through Process:Start, some dlls are not loaded
|
|
|
|
|
OK I can't think of an obvious reason then. The only time I have seen the working directory set to that of the launching process is when ProcessStartInfo.UseShellExecute is true and Process.StartInfo.WorkingDirectory has not been set.
You say some dlls are not loaded. What is the mechanism for loading these and why doesn't AppB crash if it can't find them?
|
|
|
|
|
|
Thanks for all help. I got this working. The problem was timing problem in the 3rd party dll's. AppA is starting appB in a sandbox and adds overhead (=> timing problem). Because of this timeing problem a exception was throwed before all dll:s were loaded.
(difficult to give a precise explanation of a few short lines here)
|
|
|
|