4

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

Ali
  • 309
  • 1
  • 5
  • 20

1 Answers1

6

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.

GSerjo
  • 4,725
  • 1
  • 36
  • 55
Adriano Repetti
  • 65,416
  • 20
  • 137
  • 208
  • I tried that, it didn't work. It still gives error VC80.CRT not installed. can I just add the complete Redistributable package with my installer? – Ali Jun 29 '12 at 14:11
  • You can use the [WiX bootstrapper Burn](http://robmensching.com/blog/posts/2009/7/14/Lets-talk-about-Burn) to run the executable redist. Moreover I suggest to check where redist has been installed and where SQL Server DLLs are after installation. – Adriano Repetti Jun 29 '12 at 14:18