Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a whole folder (with subfolders) as embedded resource?

Tags:

c#

.net

I have an application that upon execution It copies two folders with subfolders that are in the same location to another windows location %AppData%

Now I have the following files : MyApp.exe , Folder1, Folder2

In each folder there are subfolders. How to embed these two folders as resources inside the application so after compiling the program, I get only one executable file. And when I click on it, it extract the two folders to the same location then do the rest of job.

I know how to add a file as embedded resource then retrieve it using reflection,

but how about a folder Is that even possible??

like image 995
Rafik Bari Avatar asked Jul 03 '13 15:07

Rafik Bari


1 Answers

I had to solve this problem recently. I embedded a ZIP file, and then decompressed it at runtime.

.NET 4.5 includes ZIP functionality. If not, use SharpZipLib or DotNetZip.

like image 171
Roger Lipscombe Avatar answered Oct 29 '22 19:10

Roger Lipscombe