C++ Redistributable package with WIX

2019-06-26 15:50发布

So, I wrote a code which uses some Microsoft Sql server dlls, these dlls depends on some C++ libraries. Initially the code was not working on the client's machine but when I installed C++ Redistributable Package it worked fine.

My question is how can I install these dependencies along with my code. I am using WIX to install the software.

Thanks, Ali

1条回答
成全新的幸福
2楼-- · 2019-06-26 16:36

Do this:

First get the merge modules of C++ redistributables (MSM files). Usually they are inside the Merge Modules folder (c:\ProgramFiles\Common Files\Merge Modules) (for win x64 C:\Program Files (x86)\Common Files\Merge Modules). Their name is based on architecture (32/64 bit) and VC++ version.

In the <DirectoryRef> tag for your target directory add a <Merge> node with these attributes:

<DirectoryRef>
    <Merge
        Id="MSVCRedist" DiskId="1" Language="0"
        SourceFile="Microsoft_VC90_CRT_x86.msm"/>
</DirectoryRef>

Add the <Feature>:

<Feature
    Id="VCRedist" AllowAdvertise="no" Display="hidden" Level="1"
    Title="Visual C++ 9.0 Runtime"/>

Add the reference <MergeRef> to the previous added <Merge> section inside the <Feature> definition:

<MergeRef Id="MSVCRedist"/>

The example has been extracted from here.

查看更多
登录 后发表回答