SlideShare a Scribd company logo
1 of 62
Beginner’s Guide toWindows Installer XML (WiX)[WiX v3.5] Alek Davis http://alekdavis.blogspot.com March 2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Disclaimer From Want to sell books to Americans? Eliminate all traces of self-doubt by Ezra Klein Gillian Tett [author of Fool's Gold] describes the difference between packaging a book for the American and British markets:  "Initially I planned to start the book by admitting that I was not a true expert on high finance: instead I crashed into this world in 2005, after a background spent in journalism-cum-social anthropology – making me a well-intentioned amateur, but without complete knowledge. My friends in the British publishing world loved that honesty; in the UK, self-deprecation sells, particularly for "well-meaning amateurs" such as the writer Bill Bryson. But my American friends hated it. In New York, I was sternly told, absolutely nobody wants to listen to self-doubt. If you are going to write a book – let alone stand on a political platform or run a company – you must act as if you are an expert, filled with complete conviction. For the US version, the preface was removed entirely." I am not a "true expert" on Windows Installer 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Introduction Experience Programming Installer-related Tools and articles Streamline Your Database Setup Process with a Custom Installer (MSDN Magazine, September 2004) Follow-up: Database installer revised (Blog) Commercial database deployment software Dude, where is your installer? (Blog) Microsoft ate my uninstaller (Blog) More posts on my blog 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] What to expect? Agenda Basic Windows Installer (MSI) concepts Overview of Windows Installer XML (WiX) Using WiX to build simple installers Common advanced WiX techniques Tools and resources 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Installer tools and technologies Relevance Do you build installers? What do you use? Tools and technologies Windows Installer (MSI) Visual Studio Installer (discontinued) InstallShield Wise Installation Studio InstallAware for Windows Installer Advanced Installer And more Other InstallShield engine NullSoft Scriptable Install System Inno Setup ClickOnce And more 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Installation challenges Consider Error in the middle of setup Per-user or per-machine installation Roaming profiles and folder redirection x86, x64, any CPU 32-bit, 64-bit OS Patches and upgrades Conditional installations … 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Windows Installer (MSI) What is Windows Installer? Msiexec.exe (see command-line options) Windows Installer API Windows Installer SDK History Started around 1999 (Office 2000) Current version: 5 (Windows 7, Server 2008 R2) Pros Transactional, merge modules, discovery, automation, APIs, localization, restart management, package validation, declarative, … Cons Complexity, upgrades, architecture (one key [file] per component, …), shortcuts, command line, touches registry and file system, tools, … FAQs Windows Installer FAQ – Part 1 (see parts 2, 3, 4, etc) 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Windows Installer setup process Installation sequence(courtesy to Jeffrey Sharp) Installation (uninstallation/upgrade/etc) events occur in sequence 3/2/2011 InstallUISequence InstallExecuteSequence(Part 1: Script Generation) IMMEDIATE InstallExecuteSequence(Part 2: Script Execution) DEFERRED ,[object Object]
AppSearch
LaunchConditions
PrepareDlg
DefaultTargetDir
ValidateProductID
CostInitialize
FileCost
CostFinalize
WelcomeDlg
ResumeDlg
MaintWelcomeDlg
ProgressDlg
ExecuteAction
AppSearch
CostInitialize
ResolveSource
FileCost
CostFinalize
InstallValidate
InstallInitialize
AllocateRegistrySpace
ProcessComponents
CreateFolders
InstallFiles
MsiPublishAssemblies
CreateShortcuts
WriteRegistryValues
PublishComponents
PublishFeatures
PublishProduct
InstallFinalize
Execute generated install script, saving undo steps as installation progresses.
No errors? Complete.
Rollback: Execute accumulated undo actions.,[object Object]
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Windows Installer package (MSI file) What is it? COM structured storage file Summary info stream (product name, package GUID, MSI version, …) Database (tables: product description, install sequence, dialogs, …) Data streams (files: product files, support files, icons, …) Declarative Types MSI Standard setup package MSM Merge module MSP Update patch MST Transform package 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5]  MSI tables Required Component Condition Control CustomAction Dialog Directory Feature File … Optional Not defined in the specification Apps can use to store app-specific info 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5]  Windows Installer SDK tools Orca.exe MSI database viewer and editor Scripts WiRunSQL.vbs Updates tables in MSI database (can be used in a post-build step) More See C:rogram Filesicrosoft SDKsindows7.0amplesysmgmtsicripts 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX project Open-source Started in 1999 "Sponsored" by Microsoft Lead by Rob Mensching Current version: 3.5 Home pages Codeplex (distributions) SourceForge (documentation, bug tracking) 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX defined Windows Installer XML (WiX) XML syntax  Defines Windows Installer (MSI) package Declarative Tools 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX tools WiX Toolset Command-line tools that convert WiX source files to MSI packages Candle.exe Light.exe … Utilities and documentation Votive Integrates WiX Toolset with Visual Studio WiX project templates IntelliSense 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX/Votive vs. Visual Studio Installer Cons (WiX/Votive) Steeper learning curve Requires understanding of Windows Installer No drag-and-drop No automatic dependency inclusion Does not build bootstrappers (setup.exe) Web site Pros (WiX/Votive) More flexible More powerful Produces cleaner MSI package XML-based Clean syntax 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX project templates Visual Studio projects Windows Installer XML Setup Project Creates MSI package Merge Module Project Creates MSM package Library Project Creates WIXLIB package for use by other WiX projects (C# | VB | C++) Custom Action Project Creates a module implementing a custom action 3/2/2011
Files Solution file: 	.sln Project file: 		.wixproj Source file(s): 	.wxs Include file(s): 	.wxi(optional) Localization file(s): 	.wxl(optional) Build process (simplified) Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX project 3/2/2011 Source (.wxs) Source (.wxs) Candle Light MSI file Source (.wxs) Source (.wxs) Library (.wixlib) Source (.wxs) Inter mediate (.wixobj) Include (.wxi)
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX source file Basic structure 3/2/2011 <?xmlversion="1.0" encoding="UTF-8"?> <Wixxmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product …>   <Package … />   <Media … />   <DirectoryId="TARGETDIR" Name="SourceDir">     <DirectoryId="ProgramFilesFolder">       <DirectoryId="APPLICATIONFOLDER" Name="WiX Demo"/>     </Directory>   </Directory>   <DirectoryRefId="APPLICATIONFOLDER">     <ComponentId="C_ID" Guid="ABCDEF01-2345-6789-ABCDEF01234576" …>       <File …/>     </Component>  </DirectoryRef>  <Feature Id="F_ID" …>    <ComponentRefId="C_ID"/>  </Feature> </Product> Product.wxs
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Product, package, media Product element Id (GUID, identifies product/version/edition/etc) UpgradeCode (GUID, identifies product upgrade path) Name Manufacturer Version Language (LCID, e.g. "1033") Package element Platform (x86, x64, ia64) InstallScope (perUser, perMachine) InstallerVersion (100, 200, 300, 301, 405, 500) Description Media element Important only when CAB file is not embedded in MSI (EmbedCab="no") Use default values 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Package types Platform x86, x64, ia64 See Advanced Installer Package Types See Define platform variables for x86 and x64 builds Scope User AVOID IF POSSIBLE! Machine 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Directories Directory element Nested directory structure Under <Directory Id="TARGETDIR" Name="SourceDir"> Properties Id (primary key) System: ProgramFilesFolder, ProgramFiles64Folder, SystemFolder, System64Folder, StartMenuFolder, StartupFolder, … See A gentle introduction to Windows Installer XML Toolset User-defined: make sure it does not conflict with system names Name/LongName (of the folder: 8.3/long name) Not required for system directories LongName requires Name to be defined Caveats 32-bit vs 64-bit (see Advanced Installer Package Types) User profile-specific folders ("All Users", etc) DirectoryRef element References already defined directory 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Features Feature element Can contain other features Properties Id (text) Level (0 – disables feature; 1, 2, … - enables feature; can be modified by conditions) Title (short description/name) Description (longer description) ConfigurableDirectory(non-default directory; must be ID of a PUBLIC property) Absent (allow to exclude from installation: disallow, allow) AllowAdvertise(yes, no, system [=yes, except…]) FeatureRef element References already defined feature 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Install levels Purpose Allow selective feature installation Values  0 : feature will not be installed  1 : default installation level >1 : use for selective installation 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Feature advertisement Purpose Installs features on demand (when user first tries to run them) See Windows Installer – Overview of Windows Installer - Advertisement 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Components Component element One (key) installable (file, registry value, …) per component Properties Id (text) Guid ComponentRef element References already defined component ComponentGroup element Groups related components 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Files File element One key file per component Properties Id (text) Name (name of the file once it is installed) If ID specifies file name, Name can be omitted Source (location on the build system) KeyPath (should be "yes"; otherwise it will not be repaired) Assembly ".net" – will copy assembly file (.dll) to GAC It will ignore the Directory element settings "win32" – will not copy file to GAC AssemblyApplication Defines the main executable for a .NET DLL; if it is specified, the .NET DLL will be copied next to this executable 3/2/2011
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Files (continued) Example 3/2/2011 <Component …>  <File Id="MyApp.exe"        KeyPath="yes" Vital="yes" Assembly=".net" Checksum="yes" /> </Component> <Component …>  <File Id="MyPrivateLib.dll" KeyPath="yes" Vital="yes" Assembly=".net" AssemblyApplication="MyApp.exe" /> </Component> <Component …>  <File Id="MySharedLib.dll"  KeyPath="yes" Vital="yes" Assembly=".net" /> </Component> <Component …>  <File Id="readme.txt"       KeyPath="yes" Vital="yes" /> </Component>
Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Shortcuts Shortcut element Under the Start menu (or Desktop) folder Types Advertised (references a component; launches setup; self-repairs) Non-advertised (default; references a file) Must include RemoveFolder element RegistryValue element (defining KeyPath for component) Properties Id (text) Name (as it appears) Description (tooltip text; optional) Target (references a file on target system) Arguments (optional command-line arguments) Icon (references Icon element that must be defined; optional) Icon element must be defined and point to a file on the build system 3/2/2011

More Related Content

What's hot

ibm websphere admin training | websphere admin course | ibm websphere adminis...
ibm websphere admin training | websphere admin course | ibm websphere adminis...ibm websphere admin training | websphere admin course | ibm websphere adminis...
ibm websphere admin training | websphere admin course | ibm websphere adminis...
Nancy Thomas
 
Intoduction to VirtualBox English
Intoduction to VirtualBox EnglishIntoduction to VirtualBox English
Intoduction to VirtualBox English
Kichiemon Adachi
 

What's hot (20)

jQuery PPT
jQuery PPTjQuery PPT
jQuery PPT
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
 
How to build microservices with node.js
How to build microservices with node.jsHow to build microservices with node.js
How to build microservices with node.js
 
ibm websphere admin training | websphere admin course | ibm websphere adminis...
ibm websphere admin training | websphere admin course | ibm websphere adminis...ibm websphere admin training | websphere admin course | ibm websphere adminis...
ibm websphere admin training | websphere admin course | ibm websphere adminis...
 
jQuery - Chapter 1 - Introduction
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - Introduction
 
.Net Assemblies
.Net Assemblies.Net Assemblies
.Net Assemblies
 
Managing ESXi - Tools and Techniques
Managing ESXi - Tools and TechniquesManaging ESXi - Tools and Techniques
Managing ESXi - Tools and Techniques
 
Virtual machine
Virtual machineVirtual machine
Virtual machine
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
 
UDA-Instalación PC local_wls11_proveedores
UDA-Instalación PC local_wls11_proveedoresUDA-Instalación PC local_wls11_proveedores
UDA-Instalación PC local_wls11_proveedores
 
Introduction to virtualization
Introduction to virtualizationIntroduction to virtualization
Introduction to virtualization
 
JQuery UI
JQuery UIJQuery UI
JQuery UI
 
JQuery selectors
JQuery selectors JQuery selectors
JQuery selectors
 
Intoduction to VirtualBox English
Intoduction to VirtualBox EnglishIntoduction to VirtualBox English
Intoduction to VirtualBox English
 
Asp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework CoreAsp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework Core
 
JavaScript: Events Handling
JavaScript: Events HandlingJavaScript: Events Handling
JavaScript: Events Handling
 
Virtualization
VirtualizationVirtualization
Virtualization
 
Magento2.3 API Functional Testing
Magento2.3 API Functional TestingMagento2.3 API Functional Testing
Magento2.3 API Functional Testing
 
Virtual Box Presentation
Virtual Box Presentation Virtual Box Presentation
Virtual Box Presentation
 
VMware Workstation
VMware WorkstationVMware Workstation
VMware Workstation
 

Viewers also liked

Viewers also liked (7)

Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQL
 
SNMP/SMTP/MIME
SNMP/SMTP/MIMESNMP/SMTP/MIME
SNMP/SMTP/MIME
 
PostgreSQL and MySQL
PostgreSQL and MySQLPostgreSQL and MySQL
PostgreSQL and MySQL
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
OPEN SOURCE SEMINAR PRESENTATION
OPEN SOURCE SEMINAR PRESENTATIONOPEN SOURCE SEMINAR PRESENTATION
OPEN SOURCE SEMINAR PRESENTATION
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
 

Similar to Beginner’s Guide to Windows Installer XML (WiX)

Windows 7 Deployment
Windows 7  DeploymentWindows 7  Deployment
Windows 7 Deployment
Alex de Jong
 
Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions
9292929292
 
Virtualisation for Developers
Virtualisation for DevelopersVirtualisation for Developers
Virtualisation for Developers
elliando dias
 
Asp net mvc
Asp net mvcAsp net mvc
Asp net mvc
bgrynko
 
The Holy Grail of Deployment
The Holy Grail of DeploymentThe Holy Grail of Deployment
The Holy Grail of Deployment
Stuart King
 
Windows installerbasics
Windows installerbasicsWindows installerbasics
Windows installerbasics
seethalux
 

Similar to Beginner’s Guide to Windows Installer XML (WiX) (20)

Andres
AndresAndres
Andres
 
Windows 7 Deployment
Windows 7 DeploymentWindows 7 Deployment
Windows 7 Deployment
 
Windows 7 Deployment
Windows 7  DeploymentWindows 7  Deployment
Windows 7 Deployment
 
Windows Embedded in the Real World
Windows Embedded in the Real WorldWindows Embedded in the Real World
Windows Embedded in the Real World
 
Gadgets Windows
Gadgets WindowsGadgets Windows
Gadgets Windows
 
MikeTaulty_WPF_DevDays
MikeTaulty_WPF_DevDaysMikeTaulty_WPF_DevDays
MikeTaulty_WPF_DevDays
 
Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions
 
Microsoft windows
Microsoft windowsMicrosoft windows
Microsoft windows
 
Insider Dev Tour Taipei 2019 - Future proof your desktop apps with .net core
Insider Dev Tour Taipei 2019 - Future proof your desktop apps with .net coreInsider Dev Tour Taipei 2019 - Future proof your desktop apps with .net core
Insider Dev Tour Taipei 2019 - Future proof your desktop apps with .net core
 
Vs2005p
Vs2005pVs2005p
Vs2005p
 
Comparison of Windows and Linux Operating Systems in Advanced Features
Comparison of Windows and Linux Operating Systems in Advanced FeaturesComparison of Windows and Linux Operating Systems in Advanced Features
Comparison of Windows and Linux Operating Systems in Advanced Features
 
Virtualisation for Developers
Virtualisation for DevelopersVirtualisation for Developers
Virtualisation for Developers
 
Asp net mvc
Asp net mvcAsp net mvc
Asp net mvc
 
TDF Professional Conf 2010 - Rapid Windows 7 Deployments
TDF Professional Conf 2010 - Rapid Windows 7 DeploymentsTDF Professional Conf 2010 - Rapid Windows 7 Deployments
TDF Professional Conf 2010 - Rapid Windows 7 Deployments
 
The Holy Grail of Deployment
The Holy Grail of DeploymentThe Holy Grail of Deployment
The Holy Grail of Deployment
 
presentation
presentationpresentation
presentation
 
Windows installerbasics
Windows installerbasicsWindows installerbasics
Windows installerbasics
 
Windows installerbasics
Windows installerbasicsWindows installerbasics
Windows installerbasics
 
Windows Vista Security
Windows Vista SecurityWindows Vista Security
Windows Vista Security
 
Vistaceic2007 from CEIC 2007
Vistaceic2007 from CEIC 2007Vistaceic2007 from CEIC 2007
Vistaceic2007 from CEIC 2007
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Beginner’s Guide to Windows Installer XML (WiX)

  • 1. Beginner’s Guide toWindows Installer XML (WiX)[WiX v3.5] Alek Davis http://alekdavis.blogspot.com March 2011
  • 2. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Disclaimer From Want to sell books to Americans? Eliminate all traces of self-doubt by Ezra Klein Gillian Tett [author of Fool's Gold] describes the difference between packaging a book for the American and British markets: "Initially I planned to start the book by admitting that I was not a true expert on high finance: instead I crashed into this world in 2005, after a background spent in journalism-cum-social anthropology – making me a well-intentioned amateur, but without complete knowledge. My friends in the British publishing world loved that honesty; in the UK, self-deprecation sells, particularly for "well-meaning amateurs" such as the writer Bill Bryson. But my American friends hated it. In New York, I was sternly told, absolutely nobody wants to listen to self-doubt. If you are going to write a book – let alone stand on a political platform or run a company – you must act as if you are an expert, filled with complete conviction. For the US version, the preface was removed entirely." I am not a "true expert" on Windows Installer 3/2/2011
  • 3. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Introduction Experience Programming Installer-related Tools and articles Streamline Your Database Setup Process with a Custom Installer (MSDN Magazine, September 2004) Follow-up: Database installer revised (Blog) Commercial database deployment software Dude, where is your installer? (Blog) Microsoft ate my uninstaller (Blog) More posts on my blog 3/2/2011
  • 4. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] What to expect? Agenda Basic Windows Installer (MSI) concepts Overview of Windows Installer XML (WiX) Using WiX to build simple installers Common advanced WiX techniques Tools and resources 3/2/2011
  • 5. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Installer tools and technologies Relevance Do you build installers? What do you use? Tools and technologies Windows Installer (MSI) Visual Studio Installer (discontinued) InstallShield Wise Installation Studio InstallAware for Windows Installer Advanced Installer And more Other InstallShield engine NullSoft Scriptable Install System Inno Setup ClickOnce And more 3/2/2011
  • 6. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Installation challenges Consider Error in the middle of setup Per-user or per-machine installation Roaming profiles and folder redirection x86, x64, any CPU 32-bit, 64-bit OS Patches and upgrades Conditional installations … 3/2/2011
  • 7. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Windows Installer (MSI) What is Windows Installer? Msiexec.exe (see command-line options) Windows Installer API Windows Installer SDK History Started around 1999 (Office 2000) Current version: 5 (Windows 7, Server 2008 R2) Pros Transactional, merge modules, discovery, automation, APIs, localization, restart management, package validation, declarative, … Cons Complexity, upgrades, architecture (one key [file] per component, …), shortcuts, command line, touches registry and file system, tools, … FAQs Windows Installer FAQ – Part 1 (see parts 2, 3, 4, etc) 3/2/2011
  • 8.
  • 40. Execute generated install script, saving undo steps as installation progresses.
  • 42.
  • 43. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Windows Installer package (MSI file) What is it? COM structured storage file Summary info stream (product name, package GUID, MSI version, …) Database (tables: product description, install sequence, dialogs, …) Data streams (files: product files, support files, icons, …) Declarative Types MSI Standard setup package MSM Merge module MSP Update patch MST Transform package 3/2/2011
  • 44. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] MSI tables Required Component Condition Control CustomAction Dialog Directory Feature File … Optional Not defined in the specification Apps can use to store app-specific info 3/2/2011
  • 45. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Windows Installer SDK tools Orca.exe MSI database viewer and editor Scripts WiRunSQL.vbs Updates tables in MSI database (can be used in a post-build step) More See C:rogram Filesicrosoft SDKsindows7.0amplesysmgmtsicripts 3/2/2011
  • 46. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX project Open-source Started in 1999 "Sponsored" by Microsoft Lead by Rob Mensching Current version: 3.5 Home pages Codeplex (distributions) SourceForge (documentation, bug tracking) 3/2/2011
  • 47. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX defined Windows Installer XML (WiX) XML syntax Defines Windows Installer (MSI) package Declarative Tools 3/2/2011
  • 48. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX tools WiX Toolset Command-line tools that convert WiX source files to MSI packages Candle.exe Light.exe … Utilities and documentation Votive Integrates WiX Toolset with Visual Studio WiX project templates IntelliSense 3/2/2011
  • 49. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX/Votive vs. Visual Studio Installer Cons (WiX/Votive) Steeper learning curve Requires understanding of Windows Installer No drag-and-drop No automatic dependency inclusion Does not build bootstrappers (setup.exe) Web site Pros (WiX/Votive) More flexible More powerful Produces cleaner MSI package XML-based Clean syntax 3/2/2011
  • 50. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX project templates Visual Studio projects Windows Installer XML Setup Project Creates MSI package Merge Module Project Creates MSM package Library Project Creates WIXLIB package for use by other WiX projects (C# | VB | C++) Custom Action Project Creates a module implementing a custom action 3/2/2011
  • 51. Files Solution file: .sln Project file: .wixproj Source file(s): .wxs Include file(s): .wxi(optional) Localization file(s): .wxl(optional) Build process (simplified) Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX project 3/2/2011 Source (.wxs) Source (.wxs) Candle Light MSI file Source (.wxs) Source (.wxs) Library (.wixlib) Source (.wxs) Inter mediate (.wixobj) Include (.wxi)
  • 52. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX source file Basic structure 3/2/2011 <?xmlversion="1.0" encoding="UTF-8"?> <Wixxmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product …> <Package … /> <Media … /> <DirectoryId="TARGETDIR" Name="SourceDir"> <DirectoryId="ProgramFilesFolder"> <DirectoryId="APPLICATIONFOLDER" Name="WiX Demo"/> </Directory> </Directory> <DirectoryRefId="APPLICATIONFOLDER"> <ComponentId="C_ID" Guid="ABCDEF01-2345-6789-ABCDEF01234576" …> <File …/> </Component> </DirectoryRef> <Feature Id="F_ID" …> <ComponentRefId="C_ID"/> </Feature> </Product> Product.wxs
  • 53. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Product, package, media Product element Id (GUID, identifies product/version/edition/etc) UpgradeCode (GUID, identifies product upgrade path) Name Manufacturer Version Language (LCID, e.g. "1033") Package element Platform (x86, x64, ia64) InstallScope (perUser, perMachine) InstallerVersion (100, 200, 300, 301, 405, 500) Description Media element Important only when CAB file is not embedded in MSI (EmbedCab="no") Use default values 3/2/2011
  • 54. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Package types Platform x86, x64, ia64 See Advanced Installer Package Types See Define platform variables for x86 and x64 builds Scope User AVOID IF POSSIBLE! Machine 3/2/2011
  • 55. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Directories Directory element Nested directory structure Under <Directory Id="TARGETDIR" Name="SourceDir"> Properties Id (primary key) System: ProgramFilesFolder, ProgramFiles64Folder, SystemFolder, System64Folder, StartMenuFolder, StartupFolder, … See A gentle introduction to Windows Installer XML Toolset User-defined: make sure it does not conflict with system names Name/LongName (of the folder: 8.3/long name) Not required for system directories LongName requires Name to be defined Caveats 32-bit vs 64-bit (see Advanced Installer Package Types) User profile-specific folders ("All Users", etc) DirectoryRef element References already defined directory 3/2/2011
  • 56. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Features Feature element Can contain other features Properties Id (text) Level (0 – disables feature; 1, 2, … - enables feature; can be modified by conditions) Title (short description/name) Description (longer description) ConfigurableDirectory(non-default directory; must be ID of a PUBLIC property) Absent (allow to exclude from installation: disallow, allow) AllowAdvertise(yes, no, system [=yes, except…]) FeatureRef element References already defined feature 3/2/2011
  • 57. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Install levels Purpose Allow selective feature installation Values 0 : feature will not be installed 1 : default installation level >1 : use for selective installation 3/2/2011
  • 58. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Feature advertisement Purpose Installs features on demand (when user first tries to run them) See Windows Installer – Overview of Windows Installer - Advertisement 3/2/2011
  • 59. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Components Component element One (key) installable (file, registry value, …) per component Properties Id (text) Guid ComponentRef element References already defined component ComponentGroup element Groups related components 3/2/2011
  • 60. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Files File element One key file per component Properties Id (text) Name (name of the file once it is installed) If ID specifies file name, Name can be omitted Source (location on the build system) KeyPath (should be "yes"; otherwise it will not be repaired) Assembly ".net" – will copy assembly file (.dll) to GAC It will ignore the Directory element settings "win32" – will not copy file to GAC AssemblyApplication Defines the main executable for a .NET DLL; if it is specified, the .NET DLL will be copied next to this executable 3/2/2011
  • 61. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Files (continued) Example 3/2/2011 <Component …> <File Id="MyApp.exe" KeyPath="yes" Vital="yes" Assembly=".net" Checksum="yes" /> </Component> <Component …> <File Id="MyPrivateLib.dll" KeyPath="yes" Vital="yes" Assembly=".net" AssemblyApplication="MyApp.exe" /> </Component> <Component …> <File Id="MySharedLib.dll" KeyPath="yes" Vital="yes" Assembly=".net" /> </Component> <Component …> <File Id="readme.txt" KeyPath="yes" Vital="yes" /> </Component>
  • 62. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Shortcuts Shortcut element Under the Start menu (or Desktop) folder Types Advertised (references a component; launches setup; self-repairs) Non-advertised (default; references a file) Must include RemoveFolder element RegistryValue element (defining KeyPath for component) Properties Id (text) Name (as it appears) Description (tooltip text; optional) Target (references a file on target system) Arguments (optional command-line arguments) Icon (references Icon element that must be defined; optional) Icon element must be defined and point to a file on the build system 3/2/2011
  • 63. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Icons Icon element Properties Id (text; must contain an extension, e.g. "program.exe") SourceFile(on the build system; can be .exe, .ico file) Caveats If icon element ID does not contain extension, it may not work Icons are not always necessary 3/2/2011
  • 64. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Shortcuts (continued) Example 3/2/2011 <DirectoryId="TARGETDIR" Name="SourceDir"> <DirectoryId="ProgramFilesFolder"> <DirectoryId="APPLICATIONFOLDER" Name="WiX Demo"/> </Directory> <DirectoryId="ProgramMenuFolder"> <DirectoryId="ShortcutsFolder" Name="WiX Demo"/> </Directory> </Directory> … <DirectoryRefId="ShortcutsFolder"> <ComponentId="ProgramShortcut" Guid="ABCDEF01-2345-6789-ABCDEF01234576" …> <Shortcut Id="ClientShortcut" Name="WiX Demo Client GUI" Description="Launch WiX Demo Client GUI" Target="[APPLICATIONFOLDER]Client.exe" WorkingDirectory="APPLICATIONFOLDER" Icon="Client.exe"> <IconId="Client.exe" SourceFile="...eleaseinlient.exe"/> </Shortcut> <RemoveFolderId="ClientShortcutRemoveFolder" On="uninstall"/> <RegistryValueRoot="HKCU" Key="SoftwareiX Demolient" Name="installed" Type="integer" Value="1" KeyPath="yes"/> </Component> </DirectoryRef>
  • 65. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Registry RegistryKey element Properties Id (text) Action (none, create, createAndRemoveOnUninstall) Root (HKLM, HKCU, …) Key (path, e.g.: SOFTWAREyCompanyyProduct) RegistryValue element Defined under RegistryKey element (or must specify the key) One key path per component Properties Id (text) Action (append, prepend, write) Name (name of the value) Value (path, e.g.: SOFTWAREyCompanyyProduct) Type (data type: string, multiString, integer, binary, …) KeyPath(yes/no; one key path per component) 3/2/2011
  • 66. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Registry (continued) RemoveRegistryKey element Removes key and all of its subkeys from the Registry Properties Id (text) Action (removeOnInstall, removeOnUninstall) Root (HKLM, HKCU, …) Key (path, e.g.: SOFTWAREyCompanyyProduct) RemoveRegistryValue element Removes value from registry key Properties Id (text) Root (HKLM, HKCU, …) Key (path, e.g.: SOFTWAREyCompanyyProduct) Name (name of the value) 3/2/2011
  • 67. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Registry (continued) Example 3/2/2011 <Component …> <RegistryKey Root="HKLM" Key="SoftwareyCompany"> <RegistryValue Action="write" Name="Some Name" Type="string" Value="Some Value" KeyPath="yes" /> </RegistryKey> </Component>
  • 68. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Windows services ServiceInstall element Creates a Windows service for the specified executable Properties Id (text) Name (service name) DisplayName (service name displayed in the Services Control Panel) Description (service description) ServiceControl element Controls when a service must get started, stopped or uninstalled Properties Id (text) Name (name of the service; same as in ServiceInstall) Start, Stop, Remove (control when service must be started, stopped or uninstalled: install, uninstall, both) 3/2/2011
  • 69. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Windows services (continued) Example 3/2/2011 <Component …> <File …/> <ServiceInstall Id="SI_MyService" Name="mysvc" DisplayName="My Service" Description="Demo service that does not do anything" Start="auto" ErroControl="normal" Type="ownProcess" /> <ServiceControl Id="SC_MyService" Name="mysvc" Start="install" Stop="both" Remove="uninstall" Wait="yes" /> </Component>
  • 70. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] What else can you install? Installables Folders, files, shortcuts Windows services Registry keys, registry values COM registration info COM+ applications Drivers File extensions ODBC data sources Config files IIS web sites IIS virtual directories … 3/2/2011
  • 71. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] GUIDs Importance Identify product, upgrade path, features, components NEVER CHANGE UPGRADE CODE (GUID)… unless… Explicit (hard-coded) Generate via Visual Studio's Tools – Create GUID menu Use the registry format (can be used with or without braces) Implicit (auto-generated) Use the asterisk (Guid="*") For product: generated anew on each build. For component: hashes the full key path (stable as long as inputs do not change).  File: path + file name (can use well-known and computed names). Registry: key [+ value name].  Hashing algorithm can change if you enable/disable FIPS mode.  Use with care during development. 3/2/2011
  • 72. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Fragments Purpose Let you to split elements of the WiX document between multiple wxs files Example 3/2/2011 <?xmlversion="1.0" encoding="UTF-8"?> <Wixxmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment…> <ComponentId="C_ID1" Guid="ABCDEF01-2345-6789-ABCDEF01234576" …><File …/></Component> <ComponentId="C_ID2" Guid="01ABCDEF-2345-6789-ABCDEF01234576" …><File …/></Component> </Fragment> ClientFiles.wxs <?xmlversion="1.0" encoding="UTF-8"?> <Wixxmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product …> … <DirectoryRefId="APPLICATIONFOLDER"> <ComponentRefId="C_ID1"/> <ComponentRefId="C_ID2"/> </DirectoryRef> <Feature Id="F_ID" …> <ComponentRefId="C_ID1"/> <ComponentRefId="C_ID2"/> </Feature> </Product> Product.wxs
  • 73. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Properties Definition Global variables that Windows Installer uses during installation IDs are case-sensitive (MyProperty ≠ MYPROPERTY) Types Public Can be set and changed outside of MSI database (e.g. via command line or UI) ID in UPPERCASE:MY.CUSTOM.PROPERTY Private Set and used only internally (in the MSI database) ID in MixedCase: My.Custom.Property Common Windows Installer properties TARGETDIR, ALLUSERS, Installed, SourceDir, … Reference See Windows Installer Guide – Properties - Property Reference 3/2/2011
  • 74. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Properties (continued) Property element <Property Id="Greeting" Value="Hello!"/> Using properties [PropertyX] : Returns value of PropertyX [[PropertyX]] : Returns value of the property named by value of PropertyX <PropertyId="PropertyX" Value="PropertyY"/> <PropertyId="PropertyY" Value="Hello!"/> [[PropertyX]] = "Hello!" 3/2/2011
  • 75. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Formatted strings About Resolved during installation Windows Installer Reference – Installer Database – Installer Database Reference – Database Tables – Column Data Types – Formatted Examples [%EnvVariableName] - value of environment variable [#FileId] - full path of file (if installed) [!FileId] - full path of file in 8.3 format (if installed) … 3/2/2011
  • 76. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Variables About Resolved at compile/build time Format: $(TYPE.Name) Types var(defined in WiX source in define element; referenced projects) $(var.ProductVersion)  <?defineProductVersion="…"/> env (environment variable) $(env.PATH) : gets %PATH% environment variable sys (pre-defined system variable) $(sys.CURRENTDIR): current dir of build process $(sys.SOURCEFILEDIR ): dir containing file being processed $(sys.SOURCEFILEPATH ) : full path to file being processed $(sys.BUILDARCH ): Package element's Platform attribute (Intel, x64, Intel64) wix (defined via WixVariable element or passed via command line) $(wix.Foo)  <WixVariableId="Foo"Value="Bar"/> loc (gets a localized string from a loc[alization] file) $(loc.WelcomeMessage) 3/2/2011
  • 77. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Include files Purpose Share code between multiple projects Usage 3/2/2011 <?xmlversion="1.0" encoding="UTF-8"?> <Include> <?define ProductVersion="1.0.0.0"/> </Include> <Path_to_Solution>ommonommon.wxi <?xmlversion="1.0" encoding="UTF-8"?> <Wixxmlns="http://schemas.microsoft.com/wix/2006/wi"> <?include $(sys.SOURCEFILEDIR)..ommonommon.wxi/> … <Product Version="$(var.ProductVersion)" …> … </Product> </Wix> <Path_to_Solution>rojectDirroduct.wxs
  • 78. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Preprocessor directives Define variable <?define Foo="bar"?> Conditional blocks <?if …?><?elseif…?><?else?> <?endif?> Checking for defined variables <?ifdefFoo?> <?ifndefFoo?> Include a file <?include File.wxs?> Iteration block <?foreachFoo in "x;y;z"?> <?endforeach?> 3/2/2011
  • 79. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Preprocessor expressions When using with if, ifelse, ifdef and ifndef Literals (can be in quotes [quotes are optional]) Grouping (using parentheses) Variables (using regular variable syntax) Comparison (< > <= >= = != ~= not and or) Example 3/2/2011 <?definemyValue="3" ?> <?define system32=$(env.windir)ystem32 ?> <?define B="good var" ?> <?define C=3 ?> <?defineIExist ?> <?if $(var.Iexist) ?><!-- true --><?endif?> <?if $(var.myValue)=6 ?><!-- false --><?endif?> <?if $(var.myValue)!=3 ?><!-- false --><?endif?> <?if not "x"="y"?><!-- true --><?endif?> <?if $(env.systemdrive)=a ?><!-- false --><?endif?> <?if 3<$(var.myValue)?><!-- false --><?endif?> <?if $(var.B)="good VAR"?><!-- false --><?endif?> <?if $(var.A) and not $(env.MyEnvVariable) ?> <!-- false --> <?endif?> <?if $(var.A) Or ($(var.B) And $(var.myValue) >=3)?> <!-- true --> <?endif?> <?ifdefIExist ?> <!-- true --> <?else?> <!-- false --> <?endif?>
  • 80. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Launch conditions Purpose Use rules to enforce prerequisites for installing product, features or components Condition element Product conditions Message attribute (message displayed when condition is not met) <Product …> <Condition Message="…"><![CDATA[Installed OR VersionNT >= 600]]></Condition> </Product> Feature conditions Level attribute (if condition is met, this level will be set for the parent feature) <Feature Level="1" …> <Condition Level="0">%PROCESSOR_ARCHITECTURE = "x86"</Condition> </Component> Component conditions <Component …> <Condition><![CDATA[VersionNT < 500]]></Condition> </Component> 3/2/2011
  • 81. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Action states Purpose Determine whether the user requested a particular feature or component to be installed Syntax Ampersand + ID of feature &FeatureA = 3 Dollar sign + ID of component $ComponentX = 1 Values -1 : Unknown (no action will be taken) 1 : Advertised (feature will be installed on demand) 2 : Absent (feature/component will not be installed) 3 : Local (feature/component will be installed on a local hard drive) 4 : Source (feature/component will run from source, e.g. CD) 3/2/2011
  • 82. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Installed states Purpose Determine whether a particular feature or component is installed Syntax Features: Exclamation mark + ID of feature !FeatureA = 3 Components: Question mark + ID of component ?ComponentX = 3 Values -1 : Unknown 1 : Advertised (feature was installed as advertised) 2 : Absent (feature/component was not installed) 3 : Local (feature/component was installed on a local hard drive) 4 : Source (feature/component runs from source, e.g. CD) 3/2/2011
  • 83. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Installation phases UI sequence (InstallUISequence table) Preparation steps Searching for installed components Checking conditions Verifying disk space Selecting type of setup (install/upgrade/repair/etc) Execution sequence (InstallExecuteSequence table) System modifications Performed in two sessions Client side: UI operations; runs as interactive user Server side: system changes (copying files/etc); runs as LocalSystem user Phases Immediate phase (preparation to execution; generates rollback script) Deferred phase (only actions performed in this phase can be rolled back; mutexed) Custom Actions (CAs) that change the system must be performed in this phase 3/2/2011
  • 84. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Custom actions (CAs) in Windows Installer Purpose Execute custom code or operation CAs and installation phases See Installation Phases and In-Script Execution Options for Custom Actions in Windows Installer by Stefan Krueger (pay attention to rules) CA types for various artifacts Binary table: 1 (DLL), 2 (EXE), 5 (Jscript), 6 (VBScript) Copied during installation: 17 (DLL), 18 (EXE), 21 (Jscript), 22 (VBScript) Referencing directory: 34 (EXE) Referencing property: 50 (EXE), 53 (Jscript), 54 (VBScript) Literal code in MSI database: 37 (Jscript), 38 (VBScript) Display error and terminate setup: 19 Set a property: 51 … 3/2/2011
  • 85. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Custom actions in WiX CustomAction element Properties Id (text) Return (asyncNoWait: run in parallel with setup;asyncWait: run in parallel, but installer will wait for return code at the end of the execution sequence; check: run sequentially and check for success; ignore: run sequentially, but don't check for success) Caveats Accessing a property from a CA executed in a deferred phase Conditional execution CAs in merge modules Detailed explanation and examples See From MSI to WiX, Part 5 - Custom actions: Introduction by Alex Shevchuk 3/2/2011
  • 86. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Custom Action example Registering a COM executable via a Custom Action (CA) 3/2/2011 <CustomActionId="RegisterComServer"FileKey="MyComSrv.exe"ExeCommand=" /RegServer" Execute="deferred"Impersonate="no"Return="check" /> <CustomActionId="UnregisterComServer"FileKey="MyComSrv.exe" ExeCommand=" /UnRegServer" Execute="deferred"Impersonate="no"Return="check" /> … <InstallExecuteSequence> <CustomAction="RegisterComServer"After="InstallFiles"> NOT Installed </Custom> <CustomAction="UnregisterComServer"Before="RemoveFiles"> Installed AND NOT UPGRADINGPRODUCTCODE </Custom> </InstallExecuteSequence>
  • 87. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] User interface (UI) in WiX Default project No UI (no dialogs/UI wizards) To add UI wizards Add reference to WiXUIExtensions.dll Add UIRef element with name of specific wizard Define properties expected by the wizard Wizards WixUI_Minimal (EULA) WixUI_Advanced (scope: single or all users; program folder; feature tree) WixUI_FeatureTree (like WixUI_Advanced; default program folder only) WixUI_InstallDIr (allows to change program folder) WixUI_Mondo (Typical, Complete, or Custom setup) 3/2/2011 <Property Id="ApplicationFolderName"Value="WiX Demo" /> <Property Id="WixAppFolder"Value="WiXxperMachineFolder" /> <UI Id="UISequence"><UIRefId="WixUI_Advanced"/></UI>
  • 88. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Customizing UI Change existing dialog Minor adjustments (define bitmaps, license agreements, default folder, etc) Examples: Customizing Built-in WixUI Dialog Sets Major changes (remove, add, customize, move controls) Example: Add a checkbox to the exit dialog to launch the app, or the helpfile Modify existing wizard (dialog sequence) Example: WiX: How to skip LicenseAgreementDlg – more elegant solution Create your own dialogs Example: How do I create a custom dialog in WiX for user input? 3/2/2011
  • 89. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] WiX extensions About Distributed with WiX toolkit (in the Bin folder) Similar to .NET class libraries To use, add to project references Popular WixUIExtension.dll (UI wizards) WixIisExtension.dll (IIS configuration) WixSqlExtension.dll (SQL operations) WixUtilExtension.dll (custom actions and more) 3/2/2011
  • 90. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Tools WiX Toolkit Heat.exe Generates WiX sources from various input formats: projects, DLLs, MSIs, etc See List of Tools Other Paraffin by John Robbins (alternative to Heat) 3/2/2011
  • 91. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Upgrades Minor Don't use (unless you know why and how) Patch Don't use (unless you know why and how) Major Change package code (GUID) Change product version (only first 3 numbers in ProductVersion matter) 1.0.0.0 == 1.0.0.1 1.0.0.1 != 1.0.1.1 Retain original upgrade code (GUID) How-to: StackOverflow: How to implement WiX installer upgrade? (read all answers and comments) StackOverflow: Wix Major Upgrade: how do I prevent Windows service reinstallation? 3/2/2011
  • 92.
  • 93. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Debugging Use log file When installing msiexec/i "<PathToMsi>" /L*v "<PathToLogFile>" When uninstalling msiexec/x "<PathToMsi>" /L*v "<PathToLogFile>" 3/2/2011
  • 94. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Limitations Bootstrapper/chainer(setup.exe) Promised via the BURN tool in WiX3.5 3.6(?) (work in progress) Project output file inclusion Can be done manually (somewhat automated via the HEAT tool) COM registration info extraction From executables More StackOverflow: What are limitations of WiX and WiX Toolset? 3/2/2011
  • 95. Beginner's Guide to Windows Installer XML (WiX) [WiX v3.5] Resources Book WiX: A Developer's Guide to Windows Installer XML by Nick Ramirez Presentation Setup With Windows Installer and WiX by Jeff Sharp (video and slides) Blogs Joy of Setup by Bob Arnson (check out blog roll) Help StackOverflow WiX Project Support at SourceForge Tips StackOverflow: WiX Tips and Tricks More Learning WiX from ground up by Alek Davis (see also other parts of the series) 3/2/2011