How to release a standalone exe

Jul 3, 2015 at 9:00 AM
I want to build a release version of a program that runs an R script (from C# environment) which can run from a Windows PC without the need of also having the R library installed on the deployment PC.

If I build mt code as release the created release folder holds, among others, the libraries but misses the R libraries. I could manually copy the R.dll and maybe the rest of the stuff located in the bin/i386 folder into the release folder, and than have the library (somehow) use that library. I am not sure how to go about this though.

I am also not sure if that is the right way of doing this. Could somebody give me an idea of how to create a standalone program.
Jul 3, 2015 at 9:07 AM
In theory this is possible, in practice you should force the user to install R or write a script that does.

R is a C compiled program that is heavily platform dependent, and they jumped through all kinds of hopes to make that happen. The program compiles very differently on each platform, and you would have to distribute a binary that magically worked on each possible computer and architecture. Years of people trying has shown they are bad at this, so it's best to let R handle the installation of itself and all the libraries.

R is coded in C and requires an ungodly amount of effort to deploy on multiple machines. R.NET will work anywhere R and .NET can be installed, but it's best to leave the R and .NET installation process up to the people responsible for that.

Do not expect to be able to copy the .dll's and have those work. Those files are very platform specific.
Jul 3, 2015 at 9:15 AM
Thanks for the reply.

If I would do a static build, would that work?
Jul 3, 2015 at 9:21 AM
No, the problem is R is platform/version specific, while R.NET (and all C# code) are compiled when they run on the machine. Because C# is compiled to machine code only when run, c# exe/dll files can be copied anywhere and run (provided .NET is installed to run it wherever it lands).

R however is already compiled to machine code, If you are only deploying on the same OS and architecture, you might get away with copying a single file, but this will likely not work after some time and generally be a headache.

The R install process is pretty clean for any machine. I would just change your program to prompt the user to install R and direct them to the website.

Again, it is theoretically possible to link R/.NET/RDOTNET into one file, but exceptionally hard. I would just prompt for an R install.