。C#/。NET:创建一个CAB,没有外部库将文件添加到它创建一个、到它、文件、NET

由网友(北杳ッ)分享简介:我知道有一个similar问题但标注的答案提供了一个链接到外部库,需要多个相关性要在用户的计算机上安装。I'm aware there is a similar question but the marked answer provides a link to an external library which re...

我知道有一个similar问题但标注的答案提供了一个链接到外部库,需要多个相关性要在用户的计算机上安装。

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.

我不需要提取或其他任何花哨的像上市文件 - 我只需要一个文件夹的全部内容添加到一个CAB文件。我知道CABINET.DLL存在在 Windows System32文件夹中,我希望有一个简单的方法来使用这个DLL进行交互,实现我想要做的事情。

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 WindowsSystem32 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.

推荐答案

您可以看看维克斯更具体在 Microsoft.Deployment.Com pression.Cab 组装。它有一个很好的API,可以让你做到这一点:

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:Worksome.cab"); 
cab.Pack(@"C:Workfolder");

这是依赖于 Microsoft.Deployment.Com pression 组件,它是独立的,所以你将只需要这两个组件。

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

阅读全文

相关推荐

最新文章