How can I get my WiX product script to correctly install my active x control? - com

The situation
I have written a custom Active X control for use within another, NON-WEB, application. when I manually run "regasm /codebase MyMacTest.dll" the control is registered and it can be used within the application using a jscript interpreter. This means I need to create an ActiveXObject etc... .
So my next step is to create an install MSI using Wix toolset 3.11. According to what I have read I need to run Heat against the dll to create the output wxs content. I did that and added it to my product.wxs compiled and ran. It deployed my dll correctly, verified the registry entry however it is Not working in the application.
My c# code:
using System;
using System.Runtime.InteropServices;
namespace MyMacTest
{
[ProgId("MyMacTest.MacroTest")]
[ClassInterface(ClassInterfaceType.None)]
[Guid("765563f5-55b0-41e1-9f49-311ec88f6ba2")]
[ComVisible(true)]
public class MacroTest
{
public MacroTest()
{
}
public string GetMessage()
{
return $"This is a test for {DateTime.Now}";
}
}
}
The Heat output for the compiled DLL:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="dir39B22699688E51DCD8DCBB99A47E835B" Name="Debug" />
</DirectoryRef>
</Fragment>
<Fragment>
<DirectoryRef Id="dir39B22699688E51DCD8DCBB99A47E835B">
<Component Id="cmp88AF0B935698304B52D96A0CEA4F7661" Guid="PUT-GUID-HERE">
<Class Id="{765563F5-55B0-41E1-9F49-311EC88F6BA2}" Context="InprocServer32" Description="MyMacTest.MacroTest" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="MyMacTest.MacroTest" Description="MyMacTest.MacroTest" />
</Class>
<File Id="filC0F476996EBA80AC7C8F27AA886F48E0" KeyPath="yes" Source="SourceDir\Debug\MyMacTest.dll" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0" Name="Class" Value="MyMacTest.MacroTest" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0" Name="Assembly" Value="MyMacTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=583df5a1a2a0a8da" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#filC0F476996EBA80AC7C8F27AA886F48E0]" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32" Name="Class" Value="MyMacTest.MacroTest" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32" Name="Assembly" Value="MyMacTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=583df5a1a2a0a8da" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32" Name="CodeBase" Value="file:///[#filC0F476996EBA80AC7C8F27AA886F48E0]" Type="string" Action="write" />
</Component>
</DirectoryRef>
</Fragment>
My modified product with the heat fragment:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"><?define MyMacTest_TargetDir=$(var.MyMacTest.TargetDir)?>
<Product Id="*" Name="MyMacSetup"
Language="1033"
Version="1.0.0.0"
Manufacturer="Mega Software Stuff"
UpgradeCode="b3e8921b-22da-4f05-a79f-36cafde09fce">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<Feature Id="ProductFeature" Title="MyMacSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="cmp88AF0B935698304B52D96A0CEA4F7661"/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="Bp" Name="BPE">
<Directory Id="Addin" Name="AddIns">
<Directory Id="INSTALLFOLDER" Name="MyCustom" />
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="MyMacTest.dll" Guid="21b3cee3-1da3-4f48-89db-7c2f6cf11431">
<File Id="MyMacTest.dll" Name="MyMacTest.dll" Source="$(var.MyMacTest_TargetDir)MyMacTest.dll" />
</Component>
</ComponentGroup>
</Fragment>
<!-- This segment gotten from heat: "c:\Program Files (x86)\WiX Toolset v3.11\bin\heat" file MyMacTest.dll -out mymactest.wxs -->
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="cmp88AF0B935698304B52D96A0CEA4F7661" Guid="b33671b4-2f75-44bc-8435-f16c5f9b7268">
<Class Id="{765563F5-55B0-41E1-9F49-311EC88F6BA2}" Context="InprocServer32" Description="MyMacTest.MacroTest" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="MyMacTest.MacroTest" Description="MyMacTest.MacroTest" />
</Class>
<!--<File Id="filC0F476996EBA80AC7C8F27AA886F48E0" KeyPath="yes" Source="$(var.MyMacTest_TargetDir)MyMacTest.dll" />-->
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0" Name="Class" Value="MyMacTest.MacroTest" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0" Name="Assembly" Value="MyMacTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=583df5a1a2a0a8da" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#MyMacTest.dll]" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32" Name="Class" Value="MyMacTest.MacroTest" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32" Name="Assembly" Value="MyMacTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=583df5a1a2a0a8da" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32" Name="CodeBase" Value="file:///[#MyMacTest.dll]" Type="string" Action="write" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
My question on all of this:
After spending a couple of days I have found that there seem to be a lot of messages on this, but nothing that gives me a step by step example or explanation on how to create a wix script that will perform the "regasm /codebase" that I need to do. Kind of confusing. This is my first wix/MSI project.
What am I missing and/or what do I need to know to make this work? Is there a good step by step somewhere, that i haven't found yet, that I can be pointed to?
Update with diffs
manual registration with regasm /codebase
[HKEY_CLASSES_ROOT\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}]
#="MyMacTest.MacroTest"
[HKEY_CLASSES_ROOT\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\Implemented Categories]
[HKEY_CLASSES_ROOT\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}]
[HKEY_CLASSES_ROOT\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32]
#="mscoree.dll"
"ThreadingModel"="Both"
"Class"="MyMacTest.MacroTest"
"Assembly"="MyMacTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=583df5a1a2a0a8da"
"RuntimeVersion"="v4.0.30319"
"CodeBase"="file:///C:/Users/Kevin/OneDrive/Documents/MyMacTest.DLL"
[HKEY_CLASSES_ROOT\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0]
"Class"="MyMacTest.MacroTest"
"Assembly"="MyMacTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=583df5a1a2a0a8da"
"RuntimeVersion"="v4.0.30319"
"CodeBase"="file:///C:/Users/Kevin/OneDrive/Documents/MyMacTest.DLL"
[HKEY_CLASSES_ROOT\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\ProgId]
#="MyMacTest.MacroTest"
===========================================
msi install
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}]
#="MyMacTest.MacroTest"
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\Implemented Categories]
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}]
#=""
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32]
#="mscoree.dll"
"ThreadingModel"="Both"
"Class"="MyMacTest.MacroTest"
"Assembly"="MyMacTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=583df5a1a2a0a8da"
"RuntimeVersion"="v4.0.30319"
"CodeBase"="file:///C:\\Program Files (x86)\\BPE\\AddIns\\MyCustom\\MyMacTest.dll"
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\InprocServer32\1.0.0.0]
"Class"="MyMacTest.MacroTest"
"Assembly"="MyMacTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=583df5a1a2a0a8da"
"RuntimeVersion"="v4.0.30319"
"CodeBase"="file:///C:\\Program Files (x86)\\BPE\\AddIns\\MyCustom\\MyMacTest.dll"
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{765563F5-55B0-41E1-9F49-311EC88F6BA2}\ProgID]
#="MyMacTest.MacroTest"
Not sure why the MSI install added WOW6432Node to the paths... but these are the differences.
Thanks!

UPDATE: Be aware that COM is bitness aware. In your example you are building a 32bit MSI that will install the COM server in the 32bit registry. You may be calling it from a 64bit process and that would not work.
The way you are doing generally works. To troubleshoot you will want to:
1) Create a VM and snapshot it
2) Install your MSI
3) Run a registry diff tool such as Install Watch Pro or InControl. Take a snapshot of the registry.
4) Manually run your regasm /codebase command from an elevated command prompt.
5) Take another snapshot of the registry and run a diff report.
6) Examine the differences for meaningful relevant differences and author them into your WXS source.
7) Rebuild the MSI
8) Apply the VM Snapshot to get back to a clean state.
9) Install the MSI and retest functionality.
If you are wondering why heat didn't work by itself the answer has to do with COM. Sometimes the sniffing techniques just don't work. In the case of .NET COM Interop / COM Visible assemblies sometimes the answer lies in this caveat. In your case this might have to do with your use of the ClassInterface attribute.
https://learn.microsoft.com/en-us/dotnet/framework/tools/regasm-exe-assembly-registration-tool
You can use the /regfile option to generate a .reg file that contains
the registry entries instead of making the changes directly to the
registry. You can update the registry on a computer by importing the
.reg file with the Registry Editor tool (Regedit.exe). Note that the
.reg file does not contain any registry updates that can be made by
user-defined register functions. Note that the /regfile option only
emits registry entries for managed classes. This option does not emit
entries for TypeLibIDs or InterfaceIDs.
If you are unable to resolve this, I have 25 years experience working through these types of issues. If you are able to share the DLL and give me a code snippet to smoke test with I could create a WiX snippet that properly registers the assembly.
PS- I would merge those two components. The COM/Registry elements should belong to the same component as the file they are for.

Related

WiX: How to restart Windows Explorer to install / uninstall a shell extension

I am trying to write a WiX installer that includes a managed icon shell extension (using SharpShell). I've finally figured out how to register it via Wix (I couldn't get the SharpShell registration manager to work whenn called via WiX).
During installation, the following dialog appears:
If I select "Ignore", the icon shell extension is successfully installed and Window Explorer picks up the change immediately. I'm not sure which files that its detecting as "In Use".
During uninstall, the following dialog appears:
If you select the "Automatically close and attempt to restart" option, it closes Windows Explorer, but it does not restart at the end of the installation. I have to manually restart it via task manager.
WiX Fragment Definition
The WiX fragment that defines the shell extension installation is shown below:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>
<!-- This fragment was originally generated using heat with the following command line:
"$(WIX)bin\heat.exe" dir "$(SolutionDir)Icon ShellExtension\bin\$(ConfigurationName)" -dr IconShellExtensionDIR -cg IconShellExtension -var var.IconShellExtension.TargetDir -fips -g1 -gg -sfrag -srd -suid -template fragment -t "$(ProjectDir)AssemblyFileFilter.xslt" -out "$(ProjectDir)Fragments\IconShellExtension.wxs"
It was then subsequently manually modified, as file associations are defined in a different component the default icon entry had to be removed.
-->
<Fragment>
<DirectoryRef Id="IconShellExtensionDIR">
<Component Id="IconShellExtension.dll" Guid="D609F6F2-52FB-4153-8D6A-3E2B7F8C4647">
<Class Id="{A1C3600C-F3E5-300E-8167-541C62083DAA}" Context="InprocServer32" Description="IconShellExtension.UaProjectIconHandler" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="IconShellExtension.UaProjectIconHandler" Description="UA Project File Icon Handler" />
</Class>
<util:RestartResource ProcessName="explorer.exe"/>
<File Id="IconShellExtension.dll" KeyPath="yes" Source="$(var.IconShellExtension.TargetDir)\IconShellExtension.dll" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\InprocServer32\1.0.0.0" Name="Class" Value="IconShellExtension.UaProjectIconHandler" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\InprocServer32\1.0.0.0" Name="Assembly" Value="IconShellExtension, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9e9ad08f31c5e4fb" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#IconShellExtension.dll]" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\InprocServer32" Name="Class" Value="IconShellExtension.UaProjectIconHandler" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\InprocServer32" Name="Assembly" Value="IconShellExtension, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9e9ad08f31c5e4fb" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{A1C3600C-F3E5-300E-8167-541C62083DAA}\InprocServer32" Name="CodeBase" Value="file:///[#IconShellExtension.dll]" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="UserAppProject\ShellEx\IconHandler" Value="{a1c3600c-f3e5-300e-8167-541c62083daa}" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Explorer" Name="GlobalAssocChangedCounter" Value="1" Type="integer" Action="write" />
</Component>
<Component Id="SharpShell.dll" Guid="174E147D-4744-492F-BC5C-F00DAA4925AA">
<File Id="SharpShell.dll" KeyPath="yes" Source="$(var.IconShellExtension.TargetDir)\SharpShell.dll" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="IconShellExtension">
<ComponentRef Id="IconShellExtension.dll" />
<ComponentRef Id="SharpShell.dll" />
</ComponentGroup>
</Fragment>
</Wix>
Goal
I want the installer to be able to install or uninstall without prompting the user about files in use, and it just auto close and restart Windows Explorer during the process. My understanding is that's what the restart manager allows, and the WixUtils RestartResource tag should do this for me.
Any help would be appreciated!
UPDATE
I have tried various different combinations of properties and attempted to remove/disable the FilesInUse dialog.
I tried setting the following combination of properties as suggested in this post:
<Property Id="MSIRMSHUTDOWN" Value="2"/>
<Property Id="MSIDISABLERMRESTART" Value="0"/>
<Property Id="MSIRESTARTMANAGERCONTROL" Value="0"/>
This performed the restart of explorer.exe during uninstall, once the uninstall sequence was completed (although the length of time the explorer was shutdown for was lengthy). However, I found that when I attempt to reinstall, it displayed the FilesInUse dialog again.
I found a solution that worked for me which I will post as the accepted answer.
The best solution that seemed to work and did not display any unwanted dialogs was to remove the MSIRMSHUTDOWN and MSIDISABLERMRESTART properties and set the following property:
<!-- The following setting seems to suppress any restart dialogs -->
<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable"/>
This cleanly added or removed my shell extension. The only issue is that the shell extension remained active until I rebooted (as this was an Icon Shell Extension only, then this was acceptable to me).

Wix service not listed in the local services

I used procrun to create a windows service and tried to install it using WIX. I have placed all the required registry keys at the relevant places. But the service is still not listed in the local services. Below is my code.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="DummyInstaller" Language="1033" Version="1.0.0.0" Manufacturer="Bryan" UpgradeCode="94D1BC64-7CC1-45DA-BD5F-8ED40980E75C">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64"/>
<Property Id="JAVA_CURRENT_VERSION64">
<RegistrySearch Id="JRE_CURRENT_VERSION_REGSEARCH64" Root="HKLM" Key="SOFTWARE\JavaSoft\Java Runtime Environment" Name="CurrentVersion" Type="raw" Win64="yes" />
</Property>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="DummyInstaller" Level="1" >
<!--<ComponentGroupRef Id="NewFilesGroup" />-->
<ComponentRef Id="REGISTRY_A" />
<ComponentRef Id="PROCRUN.EXE"/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles">
<Directory Id="DummyDir" Name="DummyInstaller">
<!--<Directory Id="MyProgramDir" Name="MosquittoNew" />-->
<Directory Id="SERVERDIR" Name="Kube2UpdaterService">
<Component Id="REGISTRY_A" DiskId="1" Guid="*" Win64="no">
<RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Java" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Classpath" Value="E:\Service\Update_Service-1.0.jar" KeyPath="yes" />
<RegistryValue Type="string" Name="Jvm" Value="C:\Program Files\Java\jdk1.8.0_25\jre\bin\server\jvm.dll" />
<RegistryValue Type="multiString" Action="append" Name="Options">
<MultiStringValue Type="multiString" Name="Options" Action="append">-Duser.language=en</MultiStringValue>
<MultiStringValue Type="multiString" Name="Options" Action="append">-Duser.region=US</MultiStringValue>
</RegistryValue>
<RegistryValue Type="integer" Name="JvmMs" Value="256" />
<RegistryValue Type="integer" Name="JvmMx" Value="1024" />
<RegistryValue Type="integer" Name="JvmSs" Value="4000" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Log" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Path" Value="c:\logs" />
<RegistryValue Type="string" Name="Level" Value="Error" />
<RegistryValue Type="string" Name="Prefix" Value="Kube2UpdaterService" />
<RegistryValue Type="string" Name="StdError" Value="c:\logs\stderr.txt" />
<RegistryValue Type="string" Name="StdOutput" Value="c:\logs\stdout.txt" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Start" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Mode" Value="jvm" />
<RegistryValue Type="string" Name="Class" Value="com.kohls.kube.services.updater.UpdaterServiceMain" />
<RegistryValue Type="string" Name="Params" Value="start" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Stop" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Mode" Value="jvm" />
<RegistryValue Type="string" Name="Class" Value="com.kohls.kube.services.updater.UpdaterServiceMain" />
<RegistryValue Type="string" Name="Method" Value="stop" />
<RegistryValue Type="string" Name="Params" Value="stop" />
<RegistryValue Type="string" Name="StdOutput" Value="auto" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Kube2UpdaterService" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Description" Value="Kube updater service performing updates and installation" />
<RegistryValue Type="string" Name="DisplayName" Value="Kube2UpdaterService" />
<RegistryValue Type="string" Name="ImagePath" Value="E:\Service\prunsrv.exe //RS//Kube2UpdaterService" />
<RegistryValue Type="string" Name="DependsOnService" Value="Tcpip Afd" />
<RegistryValue Type="string" Name="ObjectName" Value="LocalSystem" />
<RegistryValue Type="integer" Name="ErrorControl" Value="1" />
<RegistryValue Type="integer" Name="Start" Value="2" />
<RegistryValue Type="integer" Name="Type" Value="16" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Kube2UpdaterService\Parameters" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Test" Value="Pass" />
</RegistryKey>
</Component>
<Component Id="PROCRUN.EXE" DiskId="1" Guid="468C2DB3-F722-4DE6-8A91-B6FB8009757D" Win64="no">
<!-- this is the renamed procrun 64 bit executable -->
<File Id="prunsrv.exe" Name="prunsrv.exe" Source="E:\Service\prunsrv.exe" />
<ServiceInstall Id="PROCRUN" Type="ownProcess" Name="Kube2UpdaterService" DisplayName="Kube2UpdaterService" Description="Kube 2.0 Updater Service" Start="auto" Account="LocalService" ErrorControl="normal" Arguments=" //RS//Kube2UpdaterService" />
<ServiceControl Id="StartPRUNSRV" Start="install" Stop="both" Remove="uninstall" Name="Kube2UpdaterService" Wait="no" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
</Wix>
What am I doing wrong here? Please advice.
All registry keys under HKLM\SYSTEM\CurrentControlSet\Services are considered internal to Windows. The supported way in MSI to configure Windows Services is to use the Service* tables, like ServiceInstall.
Your:
<File Id="prunsrv.exe" Name="prunsrv.exe" Source="E:\Service\prunsrv.exe" />
needs to set be
<File Id="prunsrv.exe" Name="prunsrv.exe" Source="E:\Service\prunsrv.exe" Keypath="yes" />
I don't know why, but it helps

Do I need MSIUSEREALADMINDETECTION for this WIX configuration with a COM DLL registration?

I have a WIX installation setup for a COM DLL that seems to work fine without the MSIUSEREALADMINDETECTION value set to 1. However, I am not sure if it works on all configurations (Windows versions, .NET versions, etc).
Would you include ("Property Id="MSIUSEREALADMINDETECTION" Value="1") in my WIX configuration file just to be 100% sure that the MSI will register the COM DLL correctly in all corner cases?
As I have understood, this property will force the installer to run with "real" administrative rights.
This is for an enterprise application so it is very important the installation goes smooth.
WIX file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- <Property Id="MSIUSEREALADMINDETECTION" Value="1" /> unsure if this is needed yet -->
<Property Id="ARPHELPLINK" Value="http://www.example.com" />
<Property Id="ARPURLINFOABOUT" Value="http://www.example.com" />
<PropertyRef Id="NETFRAMEWORK40FULL" />
<PropertyRef Id="NETFRAMEWORK40CLIENT" />
<Condition Message="This application requires .NET Framework 4.0 or later. Please install the .NET Framework 4.0 or later and then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL OR NETFRAMEWORK40CLIENT]]>
</Condition>
<WixVariable Id="WixUIDialogBmp" Value="InstallerBackgroundWix.bmp" />
<WixVariable Id="WixUIBannerBmp" Value="InstallerBannerWix.bmp" />
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="example">
<Component Id="MyAddin" Guid="guid3" Win64="no">
<File Id="exampleDLL" Source="$(var.example.TargetDir)example.dll"/>
<Class Id="{guid4}" Context="InprocServer32" Description="example" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="example" Description="example" />
</Class>
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\InprocServer32\1.0.0.0" Name="Class" Value="example.Addin" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\InprocServer32\1.0.0.0" Name="Assembly" Value="example, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#exampleDLL]" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\InprocServer32" Name="Class" Value="example.Addin" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\InprocServer32" Name="Assembly" Value="example, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{guid4}\InprocServer32" Name="CodeBase" Value="file:///[#exampleDLL]" Type="string" Action="write" />
<RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Office\Outlook\Addins\example">
<RegistryValue Type="integer" Name="LoadBehavior" Value="3"/>
<RegistryValue Type="string" Name="Description" Value="example Outlook Add-in"/>
<RegistryValue Type="string" Name="FriendlyName" Value="example Outlook Add-in"/>
</RegistryKey>
</Component>
</Directory>
</Directory>
</Directory>
</Fragment>
No, don't use it. It does not give the install any more privilege to do anything. It's a legacy setting that enables older MSI installs to get values for the Privileged and AdminUser values as they were before UAC. In other words if you ask the value of the AdminUser property in the UI sequence (before the UAC prompt) it will tell you "true" if MSIUSEREALADMINDETECTION is set and "false" if it isn't (which is considered the right answer because there's been no elevation prompt so how can the user be Admin?).
Better answer at Mark MSI so it has to be run as elevated Administrator account
Summary: One difference is it changes the user credentials that CustomActions are run under.

How to avoid unnecessary tags when use Heat in wix

I'm using HEAT to auto generate WiX fragments for a directory of files.
When the --.wxs file creating, why it include some unnecessary tags within the component?
like follows
scenario 1
<Component Id="cmpFF03591E2D2B9B2AA2AA444299A693DB" Directory="dir7307A6085BD4ABD9B8955C093FD541F5" Guid="*">
<Class Id="{00AB5D3B-4FAB-35AB-8916-59EE0247EFF1}" Context="InprocServer32" Description="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSourceElement" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSourceElement" Description="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSourceElement" />
</Class>
<Class Id="{0ED3627E-5196-3A33-8EDC-7DC7DFCE3A97}" Context="InprocServer32" Description="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ByteArrayTypeConverter" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ByteArrayTypeConverter" Description="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ByteArrayTypeConverter" />
</Class>
<Class Id="{10FA9802-2D3A-3CE4-95BB-7170AA4AE251}" Context="InprocServer32" Description="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConfigurationChangeEventSourceImpl" ThreadingModel="both" ForeignServer="mscoree.dll">
<ProgId Id="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConfigurationChangeEventSourceImpl" Description="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConfigurationChangeEventSourceImpl" />
</Class>
...........lots of class files
<File Id="fil7DC27EB4CA5B9970A7CBD422D919CCFF" KeyPath="yes" Source="$(var.SourcePath)\bin\Microsoft.Practices.EnterpriseLibrary.Common.dll" />
<ProgId Id="Record" />
<RegistryValue Root="HKCR" Key="CLSID\{00AB5D3B-4FAB-35AB-8916-59EE0247EFF1}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{00AB5D3B-4FAB-35AB-8916-59EE0247EFF1}\InprocServer32\5.0.414.0" Name="Class" Value="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSourceElement" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{00AB5D3B-4FAB-35AB-8916-59EE0247EFF1}\InprocServer32\5.0.414.0" Name="Assembly" Value="Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="string" Action="write" />
<RegistryValue Root="HKCR" Key="CLSID\{00AB5D3B-4FAB-35AB-8916-59EE0247EFF1}\InprocServer32\5.0.414.0" Name="RuntimeVersion" Value="v2.0.50727" Type="string" Action="write" />
..........lots of Registry keys
</Component>
I will copy paste the answer from my question (Wix\heat.exe strange output) because it worked for me. As Yan Sklyarenko said:
Supply heat.exe with -sreg and -scom command line switches. See heat.exe -? for more options
The Classes and Registries means the binaries is a COM binary. it's a C# COM binary since I can see ForeignServer="mscoree.dll".
if you don't want a COM binary, you can specify in your project assemlyinfo.cs marking COMVisible = false.

How can I set an icon for an asscociated file using WiX?

My application install file is being generated using WiX. In the WiX configuration I am associating a file type that works with the application. How can I associate an icon with this file type in the WiX configuration?
FROM: https://www.firegiant.com/wix/tutorial/getting-started/beyond-files/
If your application handles its own file data type, you will need to register a file association for it. Put a ProgId inside your component. FileId should refer to the Id attribute of the File element describing the file meant to handle the files of this extension. Note the exclamation mark: it will return the short path of the file instead of the long one:
<ProgId Id='AcmeFoobar.xyzfile' Description='Acme Foobar data file'>
<Extension Id='xyz' ContentType='application/xyz'>
<Verb Id='open' Sequence='10' Command='Open' Target='[!FileId]' Argument='"%1"' />
</Extension>
</ProgId>
To assign an icon to this file type, you have to specify the appropriate registry entries yourself inside your component:
<Registry Id='FooIcon1' Root='HKCR' Key='.xyz' Action='write'
Type='string' Value='AcmeFoobar.xyzfile' />
<Registry Id='FooIcon2' Root='HKCR' Key='AcmeFoobar.xyzfile' Action='write'
Type='string' Value='Acme Foobar data file' />
<Registry Id='FooIcon3' Root='HKCR' Key='AcmeFoobar.xyzfile\DefaultIcon' Action='write'
Type='string' Value='[INSTALLDIR]Foobar.exe,1' />
This is how I did it. I declared:
<Icon Id="Icon.exe" SourceFile="..\Installer\Graph.ico" />
before </Product> and added it as a reference as follows:
<ProgId Id='myApp.exe' Description='Some description' Advertise='yes' Icon='Icon.exe'>
<Extension Id='xyz' ContentType='application/text'>
<Verb Id='open' Sequence='10' Command='Open' Argument='"%1"' />
</Extension>
</ProgId>
I'd recommend following my stack overflow post located here for the simplest and most elegant way of embedding icons into a resource without the need for a c++ project in a managed .NET application.
Next, here is the proper way to set this via wix:
<Component Id="stackoverflowFileRegistration" Guid="MY_GUID">
<RegistryKey Root="HKCR" Key=".stackoverflow" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue Value="stackoverflow.Document" Type="string" KeyPath="yes" />
<RegistryValue Name="Content Type" Value="application/stackoverflow" Type="string" />
<RegistryKey Key="ShellNew" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue Name="NullFile" Value="" Type="string" />
<RegistryValue Name="Data" Value="Default new document Content.. NOTE: you must use a MutiStringValue nodes for multi-line content...." Type="string"/>
</RegistryKey>
</RegistryKey>
<RegistryKey Root="HKCR" Key="stackoverflow.Document" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue Value="stackoverflow Document" Type="string" />
<RegistryKey Key="DefaultIcon" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue Value="[INSTALLDIR]bin\stackoverflow.lib.dll, 1" Type="string" />
</RegistryKey>
<RegistryKey Key="Shell" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryKey Key="openstackoverflowwebsite" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue Value="Open Stackoverflow" Type="string" />
<RegistryKey Key="command" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue Value=""[INSTALLDIR]stackoverflow.exe" /openwebsite "%1"" Type="string" />
</RegistryKey>
</RegistryKey>
</RegistryKey>
</RegistryKey>
</Component>
This sample registers the default icon for a specific file extension (.stackoverflow) that is located in an assembly from step 1. It also shows how to create Windows Explorer associated right click commands as well as adds a menu item to the Windows Explorer New sub menu.
Thanks
-Blake Niemyjski
Please note that Dracos answer is not suffiecent for a complete icon/file association.
The following code:
This is how I did it. I declared:
<Icon Id="Icon.exe" SourceFile="..\Installer\Graph.ico" />
<ProgId Id='myApp.exe' Description='Some description' Advertise='yes' Icon='Icon.exe'>
<Extension Id='xyz' ContentType='application/text'>
<Verb Id='open' Sequence='10' Command='Open' Argument='"%1"' />
</Extension>
</ProgId>
Is only registering a file/icon association for the dialouges created by the application which is installed by the given wix-project.
To get an icon that is shown overall for all the dialogues, desktop etc. in windows you also need to register your icon for a specific filetype (extension) in regedit.