Generating GUIDs for Wix MSI files in Azure DevOps

巧了我就是萌 提交于 2019-12-24 02:44:08

问题


I am setting up a Wix installer for web server application and for a Sitecore front end application. My question is not specific to web server or Sitecore. My issues are with Wix and how to use it with continuous delivery.

1) Wix requires GUIDs for each file and the product itself. Do I need to update each GUID in the Wix file with every build? In a Git repo, that can potentially be a lot of changes.

2) If I have to update the GUIDs when each branch (dev, staging, and master) on my CD server (Azure DevOps) makes a build, how do I update the Wix file with new GUIDs in Azure DevOps?

What we really want is to be able to buid, release, deploy, and potentially rollback to last good version on each of our 3 servers (dev, staging, and master). I originally thought we would just copy the files during the deploy step, but instead I was mandated to build an MSI installer because it is cleaner and can rollback bad installs consistently easier. If you think Wix is the wrong tool or there is a better process, please also speak up. Wix really seems overly verbose: a component for basically every file with generated GUIDs for each one.


回答1:


Product-, Package-, Upgrade Code: You can use WiX's auto-GUIDs for components (for most components). Using auto-GUIDs significantly reduces WiX source complexity. Is it safe?

The Product Code, and Upgrade Code you need to manage. For most purposes you would change Product Code and Package Code for each release. Package Code can be set to auto-generate on build. In fact product code can as well, if you use major upgrades only. Nice summary from Flexera on product, package and upgrade code.


Hello WiX: There is a WiX Visual Studio Hello World example here. It should show you the basics of compiling a working setup with WiX and Visual Studio. There are also a bunch of quick start tips for WiX here (many links to samples).


Auto-Magic: You can use WiX's auto-guid feature as described here: Syntax for guids in WIX?. You simply leave out the hard coded GUID for components where WiX is able to manage the GUIDs auto-magically.

Understanding Component GUIDs: This pragmatic description of how the component GUIDs are intended to work might help understand them better: Change my component GUID in wix?

Here are other sources of information:

Rob Mensching, WiX creator:

  • http://robmensching.com/blog/posts/2003/10/18/component-rules-101/
  • http://robmensching.com/blog/posts/2003/10/4/windows-installer-components-introduction/

Flexera:

  • https://resources.flexera.com/web/pdf/archive/0012_50ef.pdf

Azure DevOps: I don't work with this environment, but if you use auto-component GUIDs, then you generally only need to update the Product Code and Product Version for each build - I am probably forgetting something. You can se the Package Code to auto-generate on build since it is merely supposed to be unique for every file (new file created for each build, so just auto-generate). Many also set the product code to auto-generate since they only use major upgrades.

I have never actually needed it, but you should be able to pass values to compiler variables inside the WiX source which means you can just pass the new version and product code (or just the version) to candle.exe, light.exe. Also see link below (msbuild). Will try to dig up a better one soon.


Some Links:

  • Best way to create a wix fragment file based on User-defined directories to be used in MSBUILD


来源:https://stackoverflow.com/questions/55360904/generating-guids-for-wix-msi-files-in-azure-devops

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!