I created a windows installer .msi file using wix tool but I'm having some errors
Errors
1. The Component/#Guid attribute's value, '47845d50-01e6-40ff-8b53-14f664bfb13a', is a mixed-case guid. All letters in a guid value should be uppercase. FileWatcherSetup in C:\Main\Src\Installer\FileWatcherSetup\Components.wxs 11
2. The component 'FileWatcher.Files' does not have an explicit key path specified. If the ordering of the elements under the Component element changes, the key path will also change. To prevent accidental changes, the key path should be set to 'yes' in one of the following locations: Component/#KeyPath, File/#KeyPath, ODBCDataSource/#KeyPath, or Registry/#KeyPath. FileWatcherSetup C:\Main\Src\Installer\FileWatcherSetup\Components.wxs 47
3. The Product/#UpgradeCode attribute's value, '11e6c23f-7a30-4651-b27a-b569765c3780', is a mixed-case guid. All letters in a guid value should be uppercase. FileWatcherSetup C:\Main\Src\Installer\FileWatcherSetup\Product.wxs 9
Anybody have any idea how to solve this. Any info or article will be helpful . Help please
UPDATE
components.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?include Defines.wxi?>
<Fragment>
<ComponentGroup Id="MenuComponents" Directory="ProductMenuFolder">
<Component Id="ProductMenuComponents" Guid="47845D50-01E6-40FF-8B53-14F664BFB13A">
<!--<Shortcut Id="UninstallPackage" Directory="ProductMenuFolder" Name="Uninstall package"
Target="[System64Folder]msiexec.exe" Arguments="/x {[ProductCode]}" Description="Uninstalls $(var.YourApplicationReference.TargetName)"/>-->
<RemoveFolder Id='ProductMenuFolder' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]'
Type='string' Value='' KeyPath='yes' />
</Component>
</ComponentGroup>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="FileWatcher">
<File Source="$(var.FileWatcher.TargetPath)" />
<!--Register this file as a Windows service-->
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Description="Sends Incoming mainframe files to the MAID Webservice"
DisplayName="FileWatcher"
Vital="yes"
Start="auto"
ErrorControl="ignore"
Interactive="no"
Name="FileWatcher"
Account="[ACCOUNT]"
Password="[PASSWORD]">
<!--<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Description="Sends Incoming mainframe files to the MAID Webservice"
DisplayName="FileWatcher"
Vital="yes"
Start="auto"
ErrorControl="ignore"
Interactive="no"
Name="FileWatcher" >-->
<ServiceConfig Id="svcConfig" DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes" OnUninstall="no" />
</ServiceInstall>
<!--Set the user to be used by the service-->
<util:User Id="ServiceUser" Name="[ACCOUNT]" Password="[PASSWORD]" CreateUser="no" LogonAsService="yes" UpdateIfExists="yes" />
<!--Added example of how to stop service automatically-->
<ServiceControl Id="ServiceControl" Stop="both" Remove="uninstall" Name="FileWatcher" Wait="yes" />
</Component>
<Component Id="FileWatcher.Files" Guid="{946A48FD-42F1-404F-A610-5A3DB388BD16}">
<!--<Component Id="MAIDFileWatcher.Files" Guid="{11E6C23F-7A30-4651-B27A-B569765C3780}">-->
<File Id="filB93E7D71690869B9CD2D0A479DB69C6C" Source="$(var.FileWatcher.TargetDir)\ExceptionHandling.dll" />
<File Id="fil487232F7A833919419AF9537A4390083" Source="$(var.FileWatcher.TargetDir)\ExceptionHandling.xml" />
<File Id="filDE3649B71309470D2D7C086E0FAABAE8" Source="$(var.FileWatcher.TargetDir)\itextsharp.dll" />
<File Id="filF73350F1AEF9ECF2621D4E63B9823029" Source="$(var.FileWatcher.TargetDir)\FileWatcher.exe.config" KeyPath='yes'/>
</Component>
</ComponentGroup>
As for the basic Windows Installer documentation:
The ProductCde documentation here says uppercase is required:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370854(v=vs.85).aspx
Component table says guids must be uppercase:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa368007(v=vs.85).aspx
and the Guid column type documentation again repeats the uppercase requirement:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa368767(v=vs.85).aspx
As PhilDW has already stated, just uppercase your GUIDs, or leave them out altogether from your components as explained here: Syntax for guids in WIX? (they will be auto-generated for you - there are some exceptions).
Also, I recommend using one file per component if your package isn't huge. This avoids all kinds of problems (for patching, upgrades, self-repair, etc...): Change my component GUID in wix? And set a key path for every component (might be done for you if there is only one file per component, I am not sure).
Obvious, but I'll add that you can create uppercase GUIDs, in Visual Studio: Tools => Create GUID => Registry Format => New Guid => Copy. Or a lot of web pages do it for you. I assume this is obvious, just throwing it in since I am writing anyway.
Related
I've recently obfuscated a DLL using Dotfuscator CE with Visual Studio 2015 Update 3. Here is the Dotfuscator.xml file I used.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.3.dtd">
<dotfuscator version="2.3">
<propertylist>
<property name="SourceDirectory" value="This Path Will Be Replaced By Visual Studio" />
<property name="SourceFile" value="This Filename Will Be Replaced By Visual Studio" />
</propertylist>
<input>
<asmlist>
<inputassembly>
<option>library</option>
<file dir="${SourceDirectory}\" name="${SourceFile}" />
</inputassembly>
</asmlist>
</input>
<output>
<file dir="${SourceDirectory}\" />
</output>
</dotfuscator>
Now the problem is, the obfuscated assembly contains some information stored in Settings.settings. file, when my code tries to access data from settings file it fails with this following exception.
The settings property 'ProxyTestURL' was not found
Here is the syntax to read setting:
Dim strURI As String = My.Settings.ProxyTestURL
I know there is a similar question "Dotfuscator : Error after obfuscation" but it doesn't seems to be either complete or robust, though I put my comments there too but here I would expect a second opinion and more robust solution instead of renaming my settings file literals to obfuscated names(as mentioned there).
You should exclude My.Settings from renaming. Instructions for doing so are in the docs.
I have a C# application with a wix setup. I have customized the ExitDialog with 2 checkboxes (following this), on used to run my application, the other one to run an optional install (for uEye camera).
The first checkbox is :
<!-- Set checkbox for launch my application -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.product)"/>
<CustomAction Id="SetExecVR3" Property="WixShellExecTarget" Value="[#MyApplication.exe]"/>
<CustomAction Id="DoExec" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return ="ignore"/>
The second :
<!-- Set checkbox for launch install uEye -->
<Property Id="WIXUI_EXITDIALOGUEYECHECKBOXTEXT" Value="Launch install uEye"/>
<CustomAction Id="SetExecUEye" Property="WixShellExecTarget" Value="./Resources/uEye64_47100_WHQL.exe"/>
And there is my Wix UI (this helped me):
<UI>
<UIRef Id="WixUI_Custom"/>
<Publish Dialog="MyExitDialog"
Control="Finish"
Event="DoAction"
Value="SetExecVR3">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
<Publish Dialog="MyExitDialog"
Control="Finish"
Event="DoAction"
Value="DoExec">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
<Publish Dialog="MyExitDialog"
Control="Finish"
Event="DoAction"
Value="SetExecUEye">WIXUI_EXITDIALOGUEYECHECKBOX = 1 and NOT Installed</Publish>
<Publish Dialog="MyExitDialog"
Control="Finish"
Event="DoAction"
Value="DoExec">WIXUI_EXITDIALOGUEYECHECKBOX = 1 and NOT Installed</Publish>
</UI>
There is my Setup :
The check bock for MyApplication.exe works good, the other one didn't. The generation didn't copy uEye64_47100_WHQL.exe in local directory and when I check the option nothing append.
I'm beginning with WiX, what did I miss ?
Edit:
Now I have a component with the .exe. The file is copied but I'm unable to run it. In log with msiexec I Have :
MSI (c) (C4:B8) [12:45:35:109]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1721
Info 1721.There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: SetExecUEye, location: C:\uEye64_47100_WHQL.exe, command:
I don't understand this error, and I don't know why the file is in C:\ (I used SourceDir to locate it)
Edit2:
The component created:
<Component Id="uEye64_47100_WHQLexe" Directory="TARGETDIR" Guid="{1BD47632-42D5-4C56-B207-1E6B1005488C}">
<File Id="uEye64_47100_WHQLexe" Source="./Resources/uEye64_47100_WHQL.exe" KeyPath="yes" Checksum="yes" Compressed="no" Vital="no"/>
</Component>
And the directory:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.compagny)"/>
</Directory>
<Directory Id="DesktopFolder" SourceName="Desktop"/>
<Directory Id="ProgramFilesFolder">
<Directory Id="PRODUCTFOLDER" Name="$(var.compagny)">
<Directory Id="INSTALLFOLDER" Name="$(var.product)">
<Directory Id="fr" Name="fr"/>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
How can define uEye64_47100_WHQLexe to be copied only in my release folder ? TARGETDIR is set to C:\
You must create another component for your uEye64_47100_WHQL.exe as for your main .exe, if you want to copy it and run on installation. If it is located only in Resource folder, it can be referenced only at the time of compilation as File source, because it is not added to installer itself. So create component like
<Component Id="uEye64_47100_WHQLexe" Directory="APPLICATIONFOLDER" Guid="*">
<File Id="uEye64_47100_WHQLexe" Source="./Resources/uEye64_47100_WHQL.exe" KeyPath="yes" Checksum="yes" />
</Component>
and then you can use it in custom action using WixShellExec like for MyApplication.exe. But I would advise to define custom action for both files like
<CustomAction Id="RunuEye64_47100_WHQLexe" FileKey="uEye64_47100_WHQLexe" ExeCommand="" Return="ignore" Impersonate="yes" />
because it can be used directly without messing with WixShellExecTarget property ;-)
Publish part of UI will than be
Event="DoAction"
Value="RunuEye64_47100_WHQLexe">
I have following Wix Code that is supposed to send the value of property to Custom Action Written in C#. Basically what I want is when the MSI is installed, I want to write the path of Folder where Wix installed the program in text file. I referred to this site and created code accordingly, but my Custom Action isn't working.
Following is my Wix File:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupInstallFolder" Language="1033" Version="1.0.0.0" Manufacturer="LP" UpgradeCode="9e10a7d8-4ffb-493c-8318-c44ba4bc0c4c">
<Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupInstallFolder" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupInstallFolder" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="SomeRandomEXE">
<File Source ="G:\SarVaGYa\myworkspace\LatestLpa\lpa\lpa_c\here\src\lpa\Release\lpa.exe" />
</Component>
</ComponentGroup>
<Binary Id="SetupCA2" src="G:\visual studio stuffs\SetupCAInstallFolder\SetupCAInstallFolder\bin\Release\SetupCAInstallFolder.CA.dll"/>
<CustomAction Id="INSTALLFOLDERFINDER" Execute="immediate" Property="INSTALLEDPATH" Value="[INSTALLFOLDER]" />
<InstallExecuteSequence>
<Custom Action="INSTALLFOLDERFINDER" Sequence="2"></Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>
I have also given my C# code that is supposed to get the value and write it in file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
namespace SetupCAInstallFolder
{
public class CustomActions
{
[CustomAction]
public static ActionResult InstallFolderFinder(Session session)
{
session.Log("Here is the SetupCAInstallFolder");
string path = session["INSTALLEDPATH"];
session.Log("Installed Path is " + path);
System.IO.File.WriteAllText("F:\\pathgenerated.txt", path);
//System.IO.File.WriteAllText(path + "installed.txt", "sdkasdkasdlkasdk");
return ActionResult.Success;
}
}
}
The Wix file compiles and gives MSI that doesn't get the value of INSTALLEDPATH . If I add DllEntry="InstallFolderFinder" in CustomAction tag, it fails with error The CustomAction/#DllEntry attribute cannot coexist with a previously specified attribute on this element. The CustomAction element may only have one of the following target attributes specified at a time: DllEntry, Error, ExeCommand, JScriptCall, Script, Value, or VBScriptCall
How do I pass the value of INSTALLEDPATH to C# Custom Action?
I have fixed the issue after stumbling around some more site. I have added the code in gist. The Wix File Code is here and the C# Custom action code is here . Basically I added
two Custom tags in InstallExexuteSequeunce that first loads the dllentry and the second passes the parameter to Custom Action Written in C#.
MSI is determining the paths between the actions CostInitialize and CostFinalize.
Using hardcoded sequences is very rarely to recommend, and maybe you have chosen the wrong sequence number for this.
Try:
<InstallExecuteSequence>
<Custom Action='INSTALLFOLDERFINDER' After='CostFinalize'></Custom>
</InstallExecuteSequence>
I hope you are sure, INSTALLDEDPATH is your the correct property. The MSI base property for paths is `TARGETDIR.
If it still doesn't work, try a custom action type 51 with setting a property MYDUMMY on the value of [INSTALLEDPATH]. Now you can see, if at least the value is correctly written in a standard custom action not programmed.
I created my event source based on this example. My event source looks like this:
[EventSource(Name = "Samples-EventSourceDemos-EventLog")]
public sealed class MinimalEventSource : EventSource
{
public static MinimalEventSource Log = new MinimalEventSource();
[Event(1, Message = "{0} -> {1}", Channel = EventChannel.Admin)]
public void Load(long baseAddress, string imageName)
{
WriteEvent(1, baseAddress, imageName);
}
}
The example use code to simulate install/uninstall process. From some other SO questions, I saw another example of installing event source using event message file.
But it is missing some good examples how to install/register the EventSource that defined by manifests. I am investigating using CustomAction to do something like:
wevtutil.exe im <EtwManifestManFile> /rf:"EtwManifestDllFile" /mf:"EtwManifestDllFile"
but wondering if you have any suggestions?
Figured out after some search. In the WixUtilExtension, there is build-in support. After referencing it and adding namespace, it is pretty easy.
Here are the changes in the Product.wxs:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
...
<Component Id="etwManifest.dll">
<File Id="etwManifest.dll" KeyPath="yes"
Source="$(var.SampleClassLibrary.TargetDir)\SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll" />
</Component>
<Component Id="etwManifest.man">
<File Id="etwManifest.man" KeyPath="yes"
Source="$(var.SampleClassLibrary.TargetDir)\SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.man">
<util:EventManifest MessageFile="[etwManifest.dll]" ResourceFile="[etwManifest.dll]"></util:EventManifest>
</File>
</Component>
</Wix>
The only trick I had to do is reduce the length of component Id and File Id (used to match with the file names) to avoid the following error: Error 25540. There was a failure while configuring XML files.
For me, the sollutions was to add permission to both files, the .dll and the .man. (https://stackoverflow.com/a/32727624/5500092)
<util:PermissionEx User="Everyone" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes" />
I also had to add the full path to correctly registrate the manifest file. When i didn't do that, the manifest file still refer to the bin/release folder of my visual studio solution.
<util:EventManifest MessageFile="[INSTALLFOLDER]SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll" ResourceFile="[INSTALLFOLDER]SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll"/>
Code:
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="etwManifest.dll" Guid="PUT-GUID-HERE">
<File Id="etwManifest.dll" KeyPath="yes" Source="$(var.SampleClassLibrary.TargetDir)\SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll" >
<util:PermissionEx User="Everyone" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes" />
<util:PermissionEx User="Administrators" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes"/>
</File>
</Component>
<Component Id="etwManifest.man" Guid="PUT-GUID-HERE">
<File Id="etwManifest.man" KeyPath="yes" Source="$(var.SampleClassLibrary.TargetDir)\SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.man" >
<util:PermissionEx User="Everyone" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes"/>
<util:PermissionEx User="Administrators" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes"/>
<util:EventManifest MessageFile="[INSTALLFOLDER]SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll" ResourceFile="[INSTALLFOLDER]SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll"/>
</File>
</Component>
</DirectoryRef>
Using WiX Toolset v3.10
(Please do correct me if my English is bad)
I was looking for answers but not found one, so I'm posting this.
I have build a windows service, which I have to install on customer server. I have successfully tested it localy (installed with installutil.exe through Visual Studio cmd prompt). Now, I'm trying to do installation using Wix Toolset 3.7. The service installs and starts ok, but I don't get anything from it. It doesn't do anything, no calls to database (as it should) and nothing. It is there, it lives, but it doesn't do sqat. A bit lazy service it is.
I can not figure ot what am I doing wrong. Here is my Wix code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="NeoSrvKrka" Language="1033" Version="1.0.0.0" Manufacturer="Neolab d.o.o." UpgradeCode="04f2a5be-92e1-4c53-8e45-7ae2740a9098">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Manufacturer="Neolab d.o.o." />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="NeoSrvKrka" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="NeoSrvKrka" />
</Directory>
</Directory>
</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">
<File Id="NeoSrvExe" Name="SalusWindowsService.exe" Source="..\SalusWindowsService\bin\Debug\SalusWindowsService.exe" Vital="yes" KeyPath="yes"></File>
<File Id="NeoSrvExeConfig" Name="SalusWindowsService.exe.config" Source="..\SalusWindowsService\bin\Debug\SalusWindowsService.exe.config" Vital="yes" KeyPath="no"></File>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="SalusKrkaService"
DisplayName="Salus Krka Service"
Description="Windows service za prenos narocil iz Salusa v Krko"
Start="auto"
Account="LocalSystem"
ErrorControl="ignore"
Interactive="no"
>
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="SalusKrkaService" Wait="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
In my app I have also created ProjectInstaller file and all the magic around it (maybe I shoudln't use this with wix?). Oh, I'm using Visual Studio 2012, .NET 4.5, c#, windows 7 (will be windows server 2012 in production).
I am adding some code that should be executing:
namespace SalusWindowsService
{
public partial class Krka : ServiceBase
{
public Krka()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
try
{
Timer timer = new Timer();
timer.Interval = 3000; //5 minut
timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
timer.Enabled = true;
GC.KeepAlive(timer);
}
catch (Exception exc)
{
//NeoException.Handle(exc);
}
}
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{ //do something, but it is not doing anything...}}}
I put some breakpoints in the code and even in the Main function of service (which just initializes base class), but I never get there.
(Answered by the OP in the question. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
It turned out i wasn't adding enough dlls to installation.
So, nothing wrong with Wix or the code. As a reminder for anyone out there doing the same mistake. You have to add ALL dll-s under wix . So, if you have multiple ddl-s in your Debug/bin folder of application, you have to add all (or at least many) of them into . That means, many tags inside one tag. Be careful, only one tag has KeyPath attribute set to "yes".