Different user.config file when application is running as scheduled task

295 Views Asked by At

I have an application that is using a settings file, and when it is running as ascheduled task, it uses another user.setting file than when im debugging the application through Visual Studio. Is this normal behaviour?

user.config from VS debugging appname.vshos_StrongName_ldr4uvycmc51wccs12nto50cvy3vujt3
user.config from Scheduled task appname.exe_Url_5fnquv0g1secc1miglozdookwwdastgw

I want the same user.config in both cases! Do I need to make a custom settings file (simple textfile) and read and write to that, or how do I solve this?

1

There are 1 best solutions below

0
On BEST ANSWER

Yes, this is normal: when debugging the config file for yourapp_vshost.exe is used which is clearly a different exe, so has a different config.

A simple solution is to create a link from one file to the other:

mklink first/path/user.config second/path/user.config

you might have to use mklink /H if the app isn't happy with it.

Or first start your exe without debugging, then attach to it.

Or deselect Enable the Visual Studio hosting process in your project's config, which will get rid of the yourapp_vshost.exe (see here to check if you need it. Bascially you don't if you don't use the designer..)