3

I have a standard c# application that acts as a GUI front end for a an "R" statistics engine. "R" consists of approx 600 files in approx 50 different folders and can be "installed" on a machine through xcopy deployment.

I would like to package up both the R engine and my c# gui into one setup.exe so that the user doesn't need to go and install R first and then my c# application seperately.

I know that I can produce a setup project and then add in the R files one by one but adding all 600 files will be very tedious!

Is there an easier way of doing what I want? Can I add the single R folder and automatically add the subfolders and files to save me adding them in one by one? Or maybe do an unzip procedure in my setup project which will unzip the R engine in one go?

sth
  • 222,467
  • 53
  • 283
  • 367
Calanus
  • 25,619
  • 25
  • 85
  • 120

5 Answers5

3

You can simply drag/drop the folder in Windows Explorer into the File System view of your Installer vdproj. All the files and folders in the hierarchy will be added to your setup project.

Tip: If the folders are in SVN or similar source control, delete all the hidden folders before you do this! If you have PowerShell, check out

get-childitem . -include _svn -force -recurse | foreach ($_) {remove-item -recurse -force $_.fullname}

Or you can always use Windows Search to find all hidden directories in the hierarchy and delete them from the Results Window.

Coxy
  • 8,844
  • 4
  • 39
  • 62
  • I can not recommend this solution. It is not possible to track changes and there is no way to delete all files at once. You spend and hour deleting each file by hand before you can re-add the changed files. – Georg W. Nov 19 '20 at 10:14
2

I think Badjer is most of the way there.

If your 600 files are part of a project and the "Build action" for each of these is set as content you can add all of these by simply:

  1. Going to the setup project
  2. Selecting Add > Project Output
  3. Selecting the project the files belong to from the drop down
  4. Selecting the "Content Files" option from the list below
  5. Clicking OK.

You can check the files will be added to the appropriate place by going to View > File System on the setup project and checking that the content files output is being added to the correct folder.

The files will be added to the install directory in the same hierarchy as they are specified in the project they belong to.

Robert Roe
  • 122
  • 9
2

I couldn't work out the project file so what I did in the end was to zip up all the files I wanted to deploy, add the zip file to the application and create a custom Installer class to unzip them (using CSharp ziplib)

Calanus
  • 25,619
  • 25
  • 85
  • 120
1

One thing you could try is adding the R files as content in the C# project - then the setup project can just copy them over for you (make sure you configure the setup file to copy content files from your project, not just the primary output).

You can either add the R folders into the project manually, or set up a script to modify the .csproj file (it's just an XML file) - content items are represented by these nodes:

<Content Include="myfile" /> 
Badjer
  • 820
  • 2
  • 9
  • 16
1

Have a look at the project file. I believe is text based. You might be able to insert the file paths directly there with some copy-paste-replace.

Aleris
  • 7,981
  • 3
  • 36
  • 42