Did you ever work this out? I have the same error using R 3.0.2 but only when the code is running on my CI server (TeamCity)... when I run the code from within Visual Studio there's no problem.
I thought it might be something to do with the environment PATH... I'd put
I thought it might be something to do with the environment PATH... I'd put
C:\Program Files\R\R-3.0.2\bin\i386
in the system PATH on my machine and I figured there was some chance that maybe TeamCity was running things in 64 bit mode where Visual Studio was running in 32 bit... so I tried adding the following code, but still no dice:// Make sure our engine can find the R installation on this machine
var envPath = Environment.GetEnvironmentVariable("PATH");
var rInstallPath = (string)Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\R-core\R", "InstallPath", @"C:\Program Files\R\R-3.0.2");
var rBinPath = Environment.Is64BitProcess ? @"\bin\x64" : @"\bin\i386";
Environment.SetEnvironmentVariable("PATH", envPath + System.IO.Path.PathSeparator + System.IO.Path.Combine(rInstallPath,rBinPath));
// Create our static engine instance
engine = REngine.CreateInstance("RDotNet");
// From v1.5, REngine requires explicit initialization.
// You can set some parameters.
engine.Initialize();
Unfortunately the UnmanagedDll
method doesn't say which dll it was unable to load/find... although I'm not sure if that would help anyway (perhaps with full path details it might).