1
votes

I made a C# winforms application which makes use of the Ghostscript library, and I have built a wix msi installer to download it on any computer. In the winforms application itself I have the Ghostscript.NET.dll (c# wrapper for gs libraries/dlls) and gsdll32.dll (32-bit native library) set as Resource files. I built a wix project (creates wixattempt2.msi) to install the application and the dll files to the Programs (x86) folder, and show the appllication on the start menu. I then built a wix bootstrapper (creates POD_Installer.exe) bundle so I could run the installer (wixattempt2.msi) and install the NetFx461Redist package if needed.

When I run POD_Installer.exe, the components I set out install do end up together in the correct folder. However, I have issues when I set out to use the winforms application. When I get to the part of the application that uses ghostscript I get an error message saying "ghostscript native library could not be found". When I expand the message it shows every component being installed except for gsdll32.dll. What changes do I make to my wix project so I don't have any issues?

Here is wixattempt2.msi :

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="POD" Language="1033" Version="1.0.0.0" Manufacturer="POD" UpgradeCode="PUT-GUID-HERE">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <Icon Id="Ruler.ico" SourceFile="Ruler.ico"/>
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="POD" />
      </Directory>
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ApplicationProgramsFolder" Name="POD"/>
      </Directory>
    </Directory> 

    <DirectoryRef Id="INSTALLFOLDER">
      <Component Id="_6lumber.exe" Guid="*">
        <File Id="_6lumber.exe" Source="POD.exe" KeyPath="yes" Checksum="yes"/>
      </Component>
            <Component Id="_notepadcalc.exe" Guid="*">
        <File Id="_notepadcalc.exe" Source="notepadcalc2.exe" KeyPath="yes" Checksum="yes"/>
      </Component>
      <Component Id="Erics_takeoff_103118.xlsx" Guid="*">
        <File Id="Erics_takeoff_103118.xlsx" Source="Erics_takeoff_103118.xlsx" KeyPath="yes"/>
      </Component>
      <Component Id="gs.dll" Guid="*" >
        <File Id="gs.dll" Source="gsdll32.dll" KeyPath="yes"/>
      </Component>
      <Component Id="gsnet.dll" Guid="*">
        <File Id="gsnet.dll" Source="Ghostscript.NET.dll" KeyPath="yes"/>
      </Component>
    </DirectoryRef>
    <DirectoryRef Id="ApplicationProgramsFolder">
      <Component Id="ApplicationShortcut" Guid="*">
        <Shortcut Id="ApplicationStartMenuShortcut"
                  Name="POD" Icon="Ruler.ico"
                  Description="My Application Description"
                  Target="[#_6lumber.exe]"
                  WorkingDirectory="INSTALLFOLDER"/>
        <Shortcut Id="ApplicationStartMenu"
                  Name="POD_CAD" Icon="Ruler.ico"
                  Description="My Application Description"
                  Target="[#_notepadcalc.exe]"
                  WorkingDirectory="INSTALLFOLDER"/>

        <RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\Microsoft\POD" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>

        <Feature Id="POD" Title="POD" Level="1">
            <ComponentRef Id="gs.dll"/>
      <ComponentRef Id="gsnet.dll"/>
            <ComponentRef Id="_6lumber.exe" />
      <ComponentRef Id="_notepadcalc.exe"/>
      <ComponentRef Id="Erics_takeoff_103118.xlsx"/>
      <ComponentRef Id="ApplicationShortcut"/>
        </Feature>
    </Product>  

</Wix>

EDIT: bootstrapper to make POD_Installer.exe

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
    <Bundle Name="POD_Installer" Version="1.0.0.0" Manufacturer="POD" UpgradeCode="732da7cb-f953-4cfd-af6e-5c25db16b47c">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
      <bal:WixStandardBootstrapperApplication
        LogoFile="Resources\custom_icon_design_flatastic_10_ruler-3.png"
        LicenseFile="Resources\mylittlelicense.rtf"
        />
    </BootstrapperApplicationRef>
    <PayloadGroup Id="NetFx461RedistPayload" >
      <Payload Name="redist\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"
               SourceFile="Resources\NDP461-KB3102436-x86-x64-AllOS-ENU.exe" />
    </PayloadGroup>
        <Chain>
            <!-- TODO: Define the list of chained packages. -->
            <!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
      <PackageGroupRef Id="NetFx461Web"/>
      <MsiPackage Id="POD_Measuring_Tool" SourceFile="C:\Users\Admin\source\repos\wixattempt2\wixattempt2\bin\Debug\wixattempt2.msi"
                  Cache="yes" ForcePerMachine ="yes"/>

    </Chain>        
    </Bundle>
</Wix>
1
try running the msi with a log file using the L*V flagmahlatse
I've done that, I'm not sure what tot make of it. When installing each component it says To be installed; Won't patch; No existing file. At the end I get message 1707 (Installation is successful)InigoMontoyaJr
Not answering your question, but.... Have you checked the license to ensure you are compliant ? You may not simply include the Ghostscript DLLs, you must include the license file, even if your own code is AGPL (and it must be in order for you to be compliant with the license). Your own code must state somewhere reasonably prominent that it uses AGPL licensed software and the license it is supplied under.KenS
Yes, good point @KenS - I was wondering whether to link to two further things: 1) Application Launch Debugging "Ideas List" / Check List and 2) Oversimplified Deployment Mnemonic or Heuristic. Just some ideas to get started thinking about the problem.Stein Åsmul

1 Answers

0
votes

Administrative Installation: We first need to determine if the file you mention is actually in the MSI at all. Let's do an admin installation - a glorified file extraction - of the MSI. In a cmd.exe (command prompt) please run this command:

msiexec.exe /a "Setup.msi"

Please see this answer for more details: Administrative Installation. Now check that the file you refer to is in the extraction folder. We will take it from there?

Mismatch: There is a mismatch between the file name and the Component and File Id in the source code, it should not matter since you refer to it correctly elsewhere, but you might want to sync it:

<Component Id="gs.dll" Guid="PUT-GUID-HERE" >
  <File Id="gs.dll" Source="gsdll32.dll" KeyPath="yes"/>
</Component>