How to make R read a config file when starting rClr?

Jul 8, 2016 at 1:37 PM
I need to do an assembly version redirection for the log4net assembly to a newer version and I can do this via config in a stand alone app. The question is is this possible for rclr running from R? And if possible, how would I name the config and which dir?
Many thanks!
Jul 12, 2016 at 1:13 AM
It turns out it all depends on how the R scripts are run. In RStudio, the process executing R is rsession.exe and the .NET config file Windows would read is rsession.exe.config in the same directory as rsession.exe.
However, if you run an R file with Rscript.exe, then you'd need the config file to be Rscript.exe.config and similarly for RGUI.exe.

There is however a better way to change the rClr code at the point when the .NET AppDomain is created. At the point when AppBaseDir was set, one can also set the ConfigurationFile in the AppDomain settings before creating the AppDomain instance. That way, one would have the config file fixed regardless which executable file is running R. I put it as "$R_HOME/library/rClr/libs/rClr.config"
Can I suggest we put this into the next release for rClr, and include the file path for the ConfigurationFile?

Thanks!