Introducing Windows Installer
Total Page:16
File Type:pdf, Size:1020Kb
www.it-ebooks.info WiX 3.6: A Developer's Guide to Windows Installer XML An in-and-out, to-the-point introduction to Windows Installer XML Nick Ramirez BIRMINGHAM - MUMBAI www.it-ebooks.info WiX 3.6: A Developer's Guide to Windows Installer XML Copyright © 2012 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: October 2010 Second edition: December 2012 Production Reference: 1051212 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78216-042-7 www.packtpub.com Cover Image by Abhishek Pandey ([email protected]) www.it-ebooks.info Credits Author Project Coordinator Nick Ramirez Arshad Sopariwala Reviewers Proofreader Neil Sleightholm Maria Gould Martin Oberhammer Paul Michniewicz Indexer Rekha Nair Roel van Bueren ENG. Nir Bar Production Coordinator Arvindkumar Gupta Acquisition Editor Usha Iyer Cover Work Arvindkumar Gupta Lead Technical Editor Dayan Hyames Technical Editor Jalasha D'costa www.it-ebooks.info About the Author Nick Ramirez is a software developer living in Columbus, Ohio. As a believer that deployment shouldn't be a moment of terror, he has become a big fan of technologies such as WiX. Other related interests include build automation, software architecture, and playing Portal 2. Nick lives with his wife and two cats. I would like to thank the hard-working folks at Packt Publishing. Their organization and planning make all the difference! I would also like to thank the dedicated people of the WiX community, who tirelessly volunteer their time to answer questions. Finally, I would like to thank the developers who contribute source code to the WiX project. Their expertise and commitment have gone towards making the best Windows deployment tool on the market. www.it-ebooks.info About the Reviewers Neil Sleightholm is an IT consultant working in the UK. He has an engineering background with experience in software development, application architecture, electronics development, and mechanical engineering. His current focus is on configuration management, build automation, installation development, and deployment. Neil has worked with most of the Microsoft platform technologies and has programmed in C, C++, C#, Visual Basic, .NET, SQL, ASP.NET, and ASP. In the build and source control field he has experience with NAnt, MSBuild, TeamBuild, Subversion (SVN), TFS, VSS, Mercurial, and CVS. He has written installation systems using Windows Installer, Windows Installer XML (WiX), Windows Installer Custom Actions (using DTF), dotNetInstaller, InnoSetup, and Wise Installation System. Neil has worked with open source projects and has been a contributor to Windows Installer XML (WiX), dotNetInstaller, and the AlienBBC plugin for Logitech Squeezebox. In his spare time he is a petrol head and keen motorcyclist. If you want to know more about him, you can check out his LinkedIn profile at: http://www.linkedin.com/in/neilsleightholm. Martin Oberhammer currently works as a Software Engineer at Sophos in Vancouver, BC. He studied computer science at the Johannes Kepler University in Linz, Austria, where he graduated in 2002. His first job in software deployment was at Utimaco Safeguard AG. In 2008, he moved to the USA and then to Canada, where he now resides. Nick and Martin where at one point colleagues and created a software installer using WiX technology. www.it-ebooks.info Paul Michniewicz is a software developer and educational consultant with diverse experiences in academia, government, and industry. As a developer, Paul has spent more than 12 years in software development and testing. Much of that time was spent in configuration management where he has managed source control systems, developed build and test automation strategies, and authored several installers in the enterprise space for companies such as JetForm and Adobe. As an educational consultant, Paul has developed and delivered introductory Java courses to professionals and students. He currently runs a tutoring business where he teaches mathematics, physical sciences, and software development to students of all ages. Paul has a special interest in working with students who have developmental needs. Paul lives in Ottawa, Canada with his wife Anne and two children Zygmunt and Moira. He is currently a stay-at-home dad and homeschools his son. To know more about Paul, you can check out his LinkedIn profile atca.linkedin.com/in/ pmichnie. Roel van Bueren works as senior consultant, trainer, and developer for ROVABU NetWorks BV and ROVABU Software BV. Roel is specialized in Software Packaging using Windows Installer and Flexera AdminStudio, Application and Desktop Management by using Microsoft System Center Configuration Manager and Novell ZENworks Configuration Management, Desktop Deployment of Microsoft Windows XP, Windows 7, and Windows 8 by using Microsoft SCCM/MDT, Novell ZENworks Configuration Management, ENGL Imaging Toolkit, and also Microsoft .NET/C# development and application virtualization. His latest projects involve "Bundle Commander" for Novell ZENworks Configuration Management and "Setup Commander" for Microsoft System Center Configuration Manager 2012, Microsoft Deployment Toolkit, and other deployment solutions such as Dell KACE and RES Automation Manager, for which customized transform files are needed to deploy MSI packages or silent switches to deploy legacy setups. www.it-ebooks.info ENG. Nir Bar is a computer engineer, and graduate of Technion – Israel Institute of Technology. Nir Bar has over 13 years experience in software and hardware development. He has worked with RAFAEL – Advanced Defense Systems, Marvell Technology Group, Agilent Technologies, Applied Materials, McKesson, and other leading high tech companies. He has worked in the Microsoft platform technologies and has programmed in C, C++, C# .NET, and SQL Server. In the Linux platform, Nir Bar has programmed in C, C++, and PERL. He is also experienced in pre-Silicon verification methodologies and tools. Currently, Nir is an independent software consultant, developer, and tutor. He consults and develops software products from the idea stage through analysis, design, development stages, and to ready-to-market products. Nir Bar tutors Windows Installer technology to Israeli software companies. To contact Nir Bar you can drop an e-mail to: [email protected]. To my wife Sarit and to my sons Itay and Yehonathan for their love, support, and encouragement. www.it-ebooks.info www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. www.it-ebooks.info www.it-ebooks.info www.it-ebooks.info To my wife, Heidi, for her patience while I disappeared into research and writing. www.it-ebooks.info www.it-ebooks.info Table of Contents Preface 1 Chapter 1: Getting Started 7 Introducing Windows Installer XML 8 What is WiX? 8 Is WiX for you? 9 Where can I get it? 10 Visual Studio package (Votive) 13 A word about GUIDs 16 Your first WiX project 16 XML declaration and Wix element 17 The Product element 18 The Package element 20 The MediaTemplate element 21 The Media element 22 The Directory element 23 The Component element 27 The File element 29 The Feature element 30 Start menu shortcuts 33 Putting it all together 37 Adding a user interface 40 Viewing the MSI database 41 Orca.exe 41 Turning logging on during installation 42 Other resources 43 Summary 43 www.it-ebooks.info Table of Contents Chapter 2: Creating Files and Directories 45 The File element 45 The DirectoryRef element 48 The ComponentGroup element