tags:

views:

1053

answers:

1

I'm aware there is a similar question but the marked answer provides a link to an external library which requires several dependencies to be installed on the user's machine.

I don't need extraction or anything else fancy like listing files - I only need to add the entire contents of a folder to a single cabinet file. I know cabinet.dll exists in the \Windows\System32 folder and I'm hoping there's a simple way to interact with this DLL to achieve what I'm trying to do.

Is it possible to do this without an external library? If anyone could point me in the right direction I'd be eternally grateful.

+2  A: 

You may take a look at WiX and more specifically the Microsoft.Deployment.Compression.Cab assembly. It has a nice API that allows you to do this:

CabInfo cab = new CabInfo(@"c:\Work\some.cab"); 
cab.Pack(@"C:\Work\folder");

It's dependent on the Microsoft.Deployment.Compression assembly which is standalone so you will need only those two assemblies.

Darin Dimitrov
I took a look at WiX but it won't install because I'm using VS2010 Beta 2. I was hoping to be able to ship something that doesn't require dependencies such as WiX to be installed.
Andy E
Just extract the two assemblies I mentioned from the MSI using LessMSIerables (http://blogs.pingpoet.com/overflow/archive/2005/06/02/2449.aspx) and ship them only.
Darin Dimitrov
...you don't need to have WiX installed.
Darin Dimitrov
oh, ok don't mind me I'm a .net newbie :) I'll try it out asap.
Andy E
Thanks, it worked and I guess I don't mind distrubuting the two dependant assemblies.
Andy E