In my code I fail at
if (!File.Exists(_configurationFileName)) {...}
In the immediate window I made a call to Directory.GetCurrentDirectory()
and it pointed me to the "work" folder rather than the "code" folder which I would have expected.
Directory.GetCurrentDirectory()
"C:\\SfDevCluster\\Data\\_App\\_Node_0\\My.Application.Type_App2\\work"
So my configuration file which is sitting right next to the executable is of course not being found.
Now I wonder what the solution is.
Since I also want to keep running the console application I don't want to implement any "if service fabric hosting, then change current directory, ..." workaround.
Any recommendations? What about my .exe.config files (if I had any, how would they be found)?
What's the reason for Service Fabric settings the current directory to "work"? Is this some kind of security mechanism?
This is how i just did it change the service manifest to point at the code
<EntryPoint>
<ExeHost>
<Program>configui.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With