WiX installer .msi doesn't install the attached .lib and .dll files - c#

So I have a fully working Product.wxs file that installs a nifty Signature drawing program. I added a TestLibrary project with a TestClass with a very basic Add(int, int) method, and used it in my program just for testing purposes, then harvested the class' directory with heat (and ran it through and XSLT file for formatting), linked the Output.wxs to the project, referenced the ComponentGroup, and tried to install the whole thing together, hoping that the class would be installed along, and the software could run. This is not the case, it builds and installs flawlessly, just for the installed .exe to fail on launch.
Here's the Product.wxs:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="6daf7a49-43a8-403b-8d15-96197c8751cc" Name="SetupProject_Sig" Language="1033" Version="1.0.0.0" Manufacturer="VTC" UpgradeCode="f2ad826c-59b9-4f9f-af0d-8c9d80030605">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Condition Message="You need to be an administrator to install this product.">
Privileged
</Condition>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupProject_Sig" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ComComponents" />
</Feature>
<Property Id="ApplicationFolderName" Value="Signature" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
<WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONFOLDER" Name="SetupProject_Sig" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<Feature Id="Complete" Title="Signature Tosz 1.0" Description="All files." Level="1" Display="expand" ConfigurableDirectory="APPLICATIONFOLDER">
<Feature Id="MainProgram" Title="Program" Description="The main executable." Level="1">
<ComponentRef Id="MainExecutable" />
<ComponentRef Id="HelperLibrary" />
<ComponentRef Id="ProgramMenuDir" />
</Feature>
<Feature Id="Documentation" Title="Description" Description="Instruction manual." Level="1000">
<ComponentRef Id="Manual" />
<Condition Level="1">FILEEXISTS</Condition>
</Feature>
</Feature>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="APPLICATIONFOLDER">
<Component Id="ProductComponent" Guid="b3594fac-7524-4529-8874-5811705996b8">
<File Source="$(var.Control_Sig.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryComp">
<RegistryKey Id="ToszRegApplicationfolder" Root="HKLM" Key="Software\VTC\Tosz 1.0" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="APPLICATIONFOLDER" Value="[APPLICATIONFOLDER]" />
<RegistryValue Type="integer" Name="Flag" Value="0" />
</RegistryKey>
</Component>
</DirectoryRef>
</Fragment>
</Wix>
The pre-build heat command:
call "%wix%\bin\heat.exe" dir "$(SolutionDir)\TestLibrary\bin\Debug" -var "var.TargetDir" -gg -g1 -srd -cg ComComponents -template fragment -out "$(ProjectDir)\Output.wxs" -v -t "$(ProjectDir)\bin\Debug\Filter.xslt"
Output.wxs
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="TARGETDIR" />
</Fragment>
<Fragment>
<ComponentGroup Id="ComComponents">
<Component Id="cmp278E5D4E5835479434800F8B4056EB4B" Directory="TARGETDIR" Guid="A09371FD-ACE5-474E-B1B8-D9C83CF05497">
<Class Id="{DB173953-D21D-3F29-BC10-C6299EBD2BFF}" Context="InprocServer32" Description="TestLibrary.TestClass" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="TestLibrary.TestClass" Description="TestLibrary.TestClass" />
</Class>
<File Id="fil296E15219B07AF9559E0660E87293FC3" KeyPath="yes" Source="$(var.TargetDir)\TestLibrary.dll" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32\1.0.0.0" Name="Class" Value="TestLibrary.TestClass" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32\1.0.0.0" Name="Assembly" Value="TestLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#fil296E15219B07AF9559E0660E87293FC3]" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32" Name="Class" Value="TestLibrary.TestClass" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32" Name="Assembly" Value="TestLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32" Name="CodeBase" Value="file:///[#fil296E15219B07AF9559E0660E87293FC3]" Type="string" Action="write" />
</Component>
<Component Id="cmp5BD81C93D46AA48BFAA1819DF54A67EB" Directory="TARGETDIR" Guid="86402057-DA0F-4B8E-BD0B-4973739A4008">
<File Id="fil108FAB265F126BACEED88B56AB065A99" KeyPath="yes" Source="$(var.TargetDir)\TestLibrary.tlb">
<TypeLib Id="{A9413C7C-F0C0-4DB1-82E3-116C411A0342}" Description="TestLibrary" HelpDirectory="TARGETDIR" Language="0" MajorVersion="1" MinorVersion="0">
<Interface Id="{A13FF8B0-AC7C-33E5-B0F3-5366304512AC}" Name="_TestClass" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" />
</TypeLib>
</File>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
The added line in Main() for testing:
System.Diagnostics.Debug.WriteLine(new TestLibrary.TestClass().Add(5, 3));
I've been trying to fix it for two days, and it's driving me nuts. Can't seem to figure out where it goes wrong, the Output looks perfect, the class should be getting installed, and yet the Signature program fails to launch.
Thanks in advance!

I don't have the intricate COM knowledge that Phil has so here's how I debug it.
Fire up a clean snapshotted VM.
Install your MSI.
Run a registry snapshot differencing tool such as InstallWatcher Pro.
Run regsvr32.exe your.dll
Take a another snapshot and compare.
Run your program to confirm regsvr32.exe fixed the problem. If not, look elsewhere for the source of your troubles.
Roll the VM snapshot back.
If so, analyze the differences and author it into your .wxs and rebuild. Rinse and repeat.

Related

C#, Wix toolset. Why does deleting and updating delete a file that was created by my application?

I have a WPF application, to create an installer, I chose the Wix toolset. My application creates a local database, it is not included in the lists of files for installation. When I uninstall the app, my DB file is deleted, this works, but when I update an application, the file is also deleted. Help me figure out how to ensure that the file is not deleted during the update, but is deleted when the application is only deleted.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?define ProductName="MyApp"?>
<?define TargetFileName="MyApp Desktop.exe"?>
<?define description="MyApp"?>
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="1.0.8.0" Manufacturer="$(var.ProductName)" UpgradeCode="e7fa5ab6-bed7-4850-97e2-270bfd182983">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="$(var.description)"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="Installer" Level="1">
<ComponentRef Id="ShortcutMenu" />
<ComponentRef Id="ShortcutDesktop" />
<ComponentRef Id="INSTALLFOLDER_Permission" />
<ComponentRef Id="MyAppFolder" />
</Feature>
<Icon Id="icon" SourceFile="IconApp.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon" />
<WixVariable Id="WixUIBannerBmp" Value="Images/TopBanner.png"/>
<WixVariable Id="WixUIDialogBmp" Value="Images/DialogBanner.png"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
<UIRef Id="WixUI_InstallDir"/>
<Feature Id="BlazorAppFeature"
Title="BlazorWasmApplication"
Level="1"
ConfigurableDirectory="INSTALLFOLDER"
AllowAdvertise="no"
Absent='disallow'>
<ComponentGroupRef Id="PublishedComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="StructureIT">
<Component Id="MyAppFolder" Guid="24f047db-b522-478e-b0aa-fcc552c2f1a2">
<RemoveFile Id="PurgeAppFolder" Name="MyAppDB.db" On="uninstall" />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="decktop"/>
<Directory Id="ProgramMenuFolder" Name="MenuFolder" >
<Directory Id="ApplicationProgramsFolder" Name="Structure IT" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<Component Id="ShortcutMenu" Guid="302df662-167e-42b7-94ae-cb2ab4dec1a6" Directory="ApplicationProgramsFolder">
<Shortcut Id="StartMenu" Name="$(var.ProductName)" Description="$(var.description)" Target ="[INSTALLFOLDER]$(var.TargetFileName)" />
<RemoveFolder Id="RemoveShortcut" On="uninstall"/>
<Registry Root="HKCU" Key="SoftWare\[Manufacturer]\[ProductName]" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Fragment>
<Fragment>
<Component Id="ShortcutDesktop" Guid="e6a03b11-01b2-45ba-b7b3-77b0c09cdd3d" Directory="DesktopFolder" >
<Shortcut Id="ShortcutDesktop" Name="$(var.ProductName)" Description="$(var.description)" Target ="[INSTALLFOLDER]$(var.TargetFileName)" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
<Registry Root="HKCU" Key="SoftWare\[Manufacturer]\[ProductName]" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Fragment>
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="INSTALLFOLDER_Permission" Guid="76f2583f-d81a-4ea7-a76a-0eb08732b3e0">
<CreateFolder>
<util:PermissionEx User="Users" GenericAll="yes"/>
</CreateFolder>
</Component>
</DirectoryRef>
</Fragment>
</Wix>
The RemoveFile On="Uninstall" doesn't mean uninstall of the application it means uninstall of the component.
https://learn.microsoft.com/en-us/windows/win32/msi/removefile-table
Because your doing a major upgrade you're essentially uninstalling and reinstalling the component thus the file is deleted.
There's a few ways to address this.
If you have an EXE bootstrapper, place the component in it's own MSI and never update the MSI. This way the bootstrapper never updates that MSI and it only gets installed once and removed once.
Change the scheduling of RemoveExistingProducts in the Major Upgrade so that components get installed first and then removed. In this way the component won't be removed until final uninstall. This has side effects though that have to be understood.
Use a custom action with a condition of REMOVE="ALL" and Not UPGRADINGPRODUCTCODE to delete the file.
Or altenatively don't delete the file at all. Microsoft guidelines do actually say you shouldn't remove user data.

How to config WIX installer to make exe to auto start when windows started

I have made C# project recently and try to run it at windows startup.
I configured WXS file in order to write Registry Run key (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)
Below is full of my WXS file.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="NACViewAgentSetupProject" Language="1033" Version="1.0.0.0" Manufacturer="JSGURU" UpgradeCode="MYGUID">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="NACViewAgentSetupProject" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="NACViewAgentSetupProject" />
</Directory>
<Directory Id="ProgramMenuFolder"></Directory>
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="ProgramMenuFolder">
<Component Id="ApplicationShortcut" Guid="MYGUID">
<Shortcut Id="ApplicationStartMenuShortcut" Name="NACViewAgent" Description="NACVIEW Agent" Target="[INSTALLFOLDER]NACViewAgent.exe" WorkingDirectory="INSTALLFOLDER">
<!--AUMID-->
<ShortcutProperty Key="System.AppUserModel.ID" Value="NACVIEW.NACViewAgent"/>
<!--COM CLSID, specifying which CLSID to activate when toast clicked-->
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{MYGUID}"/>
</Shortcut>
<RemoveFile Id="RemoveApplicationShortcut" Directory="ProgramMenuFolder" Name="NACViewAgent" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\NACVIEW" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="ApplicationAutostart" Guid="MYGUID">
<RegistryValue Root="HKCU" Action="write" Key="Software\Microsoft\Windows\CurrentVersion\Run" Name="NACViewAgent" Value="[INSTALLFOLDER]NACViewAgent.exe" Type="string"/>
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
<Component Id="NACViewAgent.exe" Guid="MYGUID">
<File Id="NACViewAgent.exe" Name="NACViewAgent.exe" Source="$(var.NACViewAgent.TargetDir)NACViewAgent.exe"/>
</Component>
<Component Id="GalaSoft.MvvmLight.dll" Guid="MYGUID">
<File Id="GalaSoft.MvvmLight.dll" Name="GalaSoft.MvvmLight.dll" Source="$(var.NACViewAgent.TargetDir)GalaSoft.MvvmLight.dll"/>
</Component>
<Component Id="Newtonsoft.Json.dll" Guid="MYGUID">
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="$(var.NACViewAgent.TargetDir)Newtonsoft.Json.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.dll" Name="Microsoft.WindowsAPICodePack.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.dll"/>
</Component>
<Component Id="CommonServiceLocator.dll" Guid="MYGUID">
<File Id="CommonServiceLocator.dll" Name="CommonServiceLocator.dll" Source="$(var.NACViewAgent.TargetDir)CommonServiceLocator.dll"/>
</Component>
<Component Id="System.Windows.Interactivity.dll" Guid="MYGUID">
<File Id="System.Windows.Interactivity.dll" Name="System.Windows.Interactivity.dll" Source="$(var.NACViewAgent.TargetDir)System.Windows.Interactivity.dll"/>
</Component>
<Component Id="GalaSoft.MvvmLight.Extras.dll" Guid="MYGUID">
<File Id="GalaSoft.MvvmLight.Extras.dll" Name="GalaSoft.MvvmLight.Extras.dll" Source="$(var.NACViewAgent.TargetDir)GalaSoft.MvvmLight.Extras.dll"/>
</Component>
<Component Id="GalaSoft.MvvmLight.Platform.dll" Guid="MYGUID">
<File Id="GalaSoft.MvvmLight.Platform.dll" Name="GalaSoft.MvvmLight.Platform.dll" Source="$(var.NACViewAgent.TargetDir)GalaSoft.MvvmLight.Platform.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" Name="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.Sensors.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.Sensors.dll" Name="Microsoft.WindowsAPICodePack.Sensors.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.Sensors.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.Shell.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.Shell.dll" Name="Microsoft.WindowsAPICodePack.Shell.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.Shell.dll"/>
</Component>
<Component Id="Microsoft.WindowsAPICodePack.ShellExtensions.dll" Guid="MYGUID">
<File Id="Microsoft.WindowsAPICodePack.ShellExtensions.dll" Name="Microsoft.WindowsAPICodePack.ShellExtensions.dll" Source="$(var.NACViewAgent.TargetDir)Microsoft.WindowsAPICodePack.ShellExtensions.dll"/>
</Component>
<!--Tell WiX to install the shortcut-->
<ComponentRef Id="ApplicationShortcut"/>
<ComponentRef Id="ApplicationAutostart"/>
</ComponentGroup>
</Fragment>
</Wix>
build wix project and install it, then I can see NACViewAgent value in Run key like below.
I restarted my machine.
but unfortunately my exe does not auto start when windows boots.
Thanks in advance!

Error while trying to build WiX installer

I am trying to build a WiX installer for my project, but everytime I build it I get these 4 errors:
Unresolved reference to symbol 'WixComponentGroup:ServerGUIPlugin.Sources' in section 'Product:{3BEDB48C-1347-4875-AA2C-920435B662E3}'. C:\Users\...\WixInstaller\Product.wxs 33
Unresolved reference to symbol 'WixComponentGroup:ServerGUIPlugin.Binaries' in section 'Product:{3BEDB48C-1347-4875-AA2C-920435B662E3}'. C:\Users\...\WixInstaller\Product.wxs 34
Unresolved reference to symbol 'WixComponentGroup:AttachToGUI.Binaries' in section 'Product:{3BEDB48C-1347-4875-AA2C-920435B662E3}'. C:\Users\...\WixInstaller\Product.wxs 37
Unresolved reference to symbol 'WixComponentGroup:ServerGUI.Binaries' in section 'Product:{3BEDB48C-1347-4875-AA2C-920435B662E3}'. C:\Users\...\WixInstaller\Product.wxs 38
They are referencing to this piece of code in Product.wxs:
<Feature Id="ProductFeature" Title="WixInstaller" Level="1">
<ComponentGroupRef Id="ServerGUIPlugin.Sources" /> <!--This line-->
<ComponentGroupRef Id="ServerGUIPlugin.Binaries" /> <!--This line-->
<ComponentGroupRef Id="RegistryGroup" />
<ComponentRef Id="comp_4ABDC32C_56A9_4E3D_9640_14D1E430A1CD" />
<ComponentGroupRef Id="AttachToGUI.Binaries" /> <!--This line-->
<ComponentGroupRef Id="ServerGUI.Binaries" /> <!--This line-->
<ComponentRef Id="comp_22A86C14_76CC_472B_9016_90FD42925402" />
</Feature>
I have searched for a solution on the internet but I just started using WiX Toolset and most of the time I don't know what they are talking about. Can anyone tell me why this is causing errors or what I should do to fix it?
Update
Our problem was solved! Here is how we did it:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Component Id="comp_22A86C14_76CC_472B_9016_90FD42925402" Guid="..." Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="..." DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="GMap.NET.Core.dll" Source="..." KeyPath="yes" />
<File Id=".." DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="GMap.NET.WindowsForms.dll" Source="..." />
<File Id="..." DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="GUIComponents.dll" Source="..." />
<File Id="..." DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="ServerGUIPlugin.dll" Source="..." />
</Component>
<Directory Id="..." Name="Plugin Source">
<Directory Id="ServerGUIPlugin.Sources" />
<Directory Id="ServerGUIPlugin.Binaries" />
</Directory>
<Directory Id="AttachToGUI.Binaries" />
<Directory Id="ServerGUI.Binaries" />
<Component Id="comp_4ABDC32C_56A9_4E3D_9640_14D1E430A1CD" Guid="..." Permanent="no" SharedDllRefCount="no" Transitive="no">
<File Id="..." DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="Attach.ico" Source="..." KeyPath="yes" />
</Component>
</Directory>
<DirectoryRef Id="ServerGUI.Binaries">
<Component Id="ServerGUI.exe" Guid="...">
<File Id="ServerGUI.exe" Source="..." KeyPath="yes" Checksum="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="AttachToGUI.Binaries">
<Component Id="AttachToGUI.exe" Guid="...">
<File Id="AttachToGUI.exe" Source="..." KeyPath="yes" Checksum="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="ServerGUIPlugin.Binaries">
<Component Id="ServerGUIPlugin.dll" Guid="...">
<File Id="ServerGUIPlugin.dll" Source="..." KeyPath="yes" Checksum="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="ServerGUIPlugin.Sources">
<Component Id="PluginBase.cs" Guid="...">
<File Id="PluginBase.cs" Source="..." KeyPath="yes" Checksum="yes" />
</Component>
<Component Id="SGPluginAttribute.cs" Guid="...">
<File Id="SGPluginAttribute.cs" Source="..." KeyPath="yes" Checksum="yes" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ServerGUI.Binaries">
<ComponentRef Id="ServerGUI.exe" />
</ComponentGroup>
<ComponentGroup Id="AttachToGUI.Binaries">
<ComponentRef Id="AttachToGUI.exe" />
</ComponentGroup>
<ComponentGroup Id="ServerGUIPlugin.Binaries">
<ComponentRef Id="ServerGUIPlugin.dll" />
</ComponentGroup>
<ComponentGroup Id="ServerGUIPlugin.Sources">
<ComponentRef Id="PluginBase.cs" />
<ComponentRef Id="SGPluginAttribute.cs" />
</ComponentGroup>
</Fragment>
That's a lot of code but since I coulnd't find it anywhere I figured I may as well leave it here

Develop .msi file using wix toolset and heat toolset for BHO PLugin

Scenario I have created a .dll file for Internet Explorer 10 Plugin. Using regasm I register the .dll and works fine in IE10. I want to develop a .msi file so that i can distribute it. I am having several problems while developing it. During installation the dll files should be registered in the registry, but the files are never getting registered, but without the .msi file, if simply registering the .dll works well. The problem occurs when the .dll files are packaged into .msi file. I have gone through the Wix doc, there it is suggested to use heat toolset. Following was the output
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="dirCFD54C07EFB094CAD317543172D62CC3" Name="bin" />
</DirectoryRef>
</Fragment>
<Fragment>
<DirectoryRef Id="dirCFD54C07EFB094CAD317543172D62CC3">
<Component Id="cmpA742B1B0BA7235FA026C505929929E25" Guid="{A6A2DF10-0BC0-410d- 8582-79DA83A83F19}">
<Class Id="{8A194578-81EA-4850-9911-13BA2D71EFBD}" Context="InprocServer32" Description="Greyhound.BHO.BHO" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="Greyhound.BHO.BHO" Description="Greyhound.BHO.BHO" />
</Class>
<File Id="filB636C21F357A14C42DFD0FBC9300D2F4" KeyPath="yes" Source="SourceDir\bin\greyhound.dll" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\InprocServer32\1.0.0.0" Name="Class" Value="Greyhound.BHO.BHO" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\InprocServer32\1.0.0.0" Name="Assembly" Value="Greyhound, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#filB636C21F357A14C42DFD0FBC9300D2F4]" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\InprocServer32" Name="Class" Value="Greyhound.BHO.BHO" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\InprocServer32" Name="Assembly" Value="Greyhound, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{8A194578-81EA-4850-9911-13BA2D71EFBD}\InprocServer32" Name="CodeBase" Value="file:///[#filB636C21F357A14C42DFD0FBC9300D2F4]" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{8a194578-81ea-4850-9911-13ba2d71efbd}" Name="Alright" Value="1" Type="integer" Action="write" />
</Component>
</DirectoryRef>
</Fragment>
I am getting confused as to where should I include this output into my .wxs file.Even generating the above file , still the problem of registering the .dll exists.
If somebody can throw some light on it would be appreciated.Thank you
To include the generated output you only have to add a ComponentRef in your feature
<ComponentRef Id="cmpA742B1B0BA7235FA026C505929929E25" />
You have to specify both your .wxs files (the one containing your product and the generated file) in the candle command and then both generated .wixobj files in your light command.
Check this link for more Information about cross file references:
http://wix.tramontana.co.hu/tutorial/upgrades-and-modularization/fragments
When harvesting multiple files consider using the "-cg ComponentGroupName" flag with heat.
With that you can include all components at once
<ComponentGroupRef Id="ComponentGroupName" />
About the registry keys not getting created, there could be multiple reasons. Maybe the file greyhound.dll is already at the desired location. Windows will only look if the keypath of the component exists, if it does the whole component won't be installed.
Look into the logs in the AppData\Local\Temp folder for more information

Registry change upon installing application C#

Just about to try and make an install package for an app for that first time with visual studio. I have a registry value that needs to be changed when the program is installed I need the program to start everytime the computer starts.
Is this a fairly trivial task? Could someone point me towards something to try and achieve this.
So far I just have the app with it's forms etc.
I have same problem, I'm using WIX and follow the answer from this Stackoverflow question. I'm also new on WIX, here's my full WIX working script if you might interest (tested on Windows XP & Windows 8.1):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="FooSetup" Language="1033"
Version="1.0.1.1"
Manufacturer="Foo Enterprise"
UpgradeCode="9235c293-2f08-4c2b-b7a5-69d01f5fca32">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<!-- Step 1: Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="FooSetup" />
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Foo Application"/>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<!-- Step 2: Add files to your installer package & add autostart feature -->
<DirectoryRef Id="INSTALLFOLDER">
<!-- The main executable file-->
<Component Id="FooApplication" Guid="3F122E60-3745-4AEB-ADA3-B90DCB87E0BD">
<File Id="FooMainApp" Source="$(var.Foo.TargetPath)" KeyPath="yes"/>
</Component>
<!-- The main lib file-->
<Component Id="FooLib" Guid="83BEDB02-C9F5-4A06-B3D5-0A4D61D6A99C">
<File Id="FooFileLib" Source="$(var.Foo.Lib.TargetPath)" KeyPath="yes"/>
</Component>
<!-- Register windows autostart registry -->
<Component Id="RegistryEntries" Guid="45C7AC46-1101-4301-83E1-D24392283A60">
<RegistryValue Type="string"
Name="FooStartup"
Value="[#FooMainApp]"
Root="HKLM"
Key="Software\Microsoft\Windows\CurrentVersion\Run"
Action="write"/>
</Component>
</DirectoryRef>
<!-- Step 3: Add the shortcut to your installer package -->
<!-- Start Menu -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="FooShortcutMenu" Guid="3874D005-4E1C-4C0E-9CEA-8CD8D5442B60">
<Shortcut Id="FooApplicationStartMenuShortcut"
Name="Foo Application"
Description="The Foo is Cool!"
Target="[#FooMainApp]"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\FooApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Desktop Menu -->
<DirectoryRef Id="DesktopFolder">
<Component Id="FooDesktopShortcutMenu" Guid="D4D0A2ED-C0DB-4524-AC53-D30F904DB846">
<Shortcut Id="FooApplicationDesktopShortcut"
Name="Foo Application"
Description="The Foo is Cool!"
Target="[#FooMainApp]"
WorkingDirectory="INSTALLFOLDER"
Directory="DesktopFolder"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\FooApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Tell Wix -->
<Feature Id="ProductFeature" Title="FooSetup" Level="1">
<ComponentRef Id="FooApplication" />
<ComponentRef Id="FooLib" />
<ComponentRef Id="FooShortcutMenu"/>
<ComponentRef Id="FooDesktopShortcutMenu"/>
<ComponentRef Id="RegistryEntries" />
</Feature>
</Product>
</Wix>
It depends the tool you used to create the install package, generally you need to add a String Value under
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run or
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
like "AppName" : "AppPath"
You also can achieve this by add the regstry in your code.

Categories

Resources