How to convert vdproj file to WiX format? - msbuild

I need to convert a vdproj file to WiX format so that I can get it building using msbuild. One solution was to call the devenv executable from msbuild and build the vdproj file from there but that's just nasty. I thought that I would try manually converting the file to WiX format but looking at its contents scared me quite a bit. Are there any tools or elegant solutions that could possibly help with this conversion?

You can try work with Dark which converts any MSI into Wix. You will need to remove a lot of "junk" especially in the UI areas but it will give you a decent start.

There is a utility by Chris Oldwood that converts a .vdproj to .wxs (using powerscript command line)
I hope that helps, this is my current research and I will report back on any issues.
Once converted do not forget WixEdit.
Microsoft have removed .vdproj from VS2012.

"VDProj to WiX Converter" will help you to convert vdProj file to wix.
It can be downloaded from the link
http://visualstudiogallery.msdn.microsoft.com/0f8ff662-c844-4c3c-9c7b-b170cea16baf

If you want to switch to NSIS or Inno Setup you can use Visual & Installer extension: http://visualstudiogallery.msdn.microsoft.com/5e57fe9a-ae5d-4740-a1c3-7a8e278e105b
It also supports conversion from .vdproj files into NSIS or Inno Setup script.

Related

Can I convert a sequence of wxi files to a Visual Studio Wix Project?

I have a lot of wxi files for a Wix setup.
All together works great as a setup but I think But it works good.
But with changes and extensions it is extremely confusing.
Looks like:
Product.wxs
App.wxi
CustomAction.wxi
Firewall.wxi
Feature.wxi
en-us.wxl
Can I convert all these somehow to a Visual Studio Wix Project? And if yes how I can do it?
Short Version: Below is an attempted generic answer: 1) You can use another tool such as Advanced Installer or Installshield, 2) you can find help with WiX to continue to use it, and 3) you can even use dark.exe to convert other MSIs to WiX format (this can help you with WiX markup syntax - you can implement in another tool and covert to WiX - then the markup will work).
WiX is particularly good - I think - for corporate in-house use (large companies) where expertise is readily available and can be maintained over time. For a lone developer who does setups once a year it might be too much to handle with all the flexibility and syntax?
Alternative Tools: I forget my ad-hoc quick overview of MSI tools in the comments above. Both Advanced Installer (help portal) and Installshield have excellent features that makes you able to deliver setups quicker than with WiX.
Advanced Installer and Installshield should have features to import many project types. I have not tested lately, there could be changes.
Update: https://www.advancedinstaller.com/import.html
VS Installer Projects Limitations: WiX has the flexibility needed to make pretty much anything you need, Visual Studio Installer Projects have many limitations (short list form). I would not recommend going for a conversion - especially since this setup looks to be complicated enough to require WiX's flexibility.
WiX Quick Start Material: If you go here and click the "WiX Samples" entry there is a list of WiX resources in the grid. Also, have a look at "WiX Quick Start" section here.
Dark.exe: In fact, WiX has a tool called Dark.exe which can be used to decompile an MSI file to WiX markup. In other words it is generally easier to move to WiX than from it - although Advanced Installer and Installshield should be able to import WiX and other project files and also import MSI files.
Dark.exe, Sample Syntax:
dark.exe -x outputfolder MySetup.msi
An answer on MSI files and viewers: How can I compare the content of two (or more) MSI files?

How to create .msi installer with WiX

Can someone help me understand how WiX works? I have a directory structure which I would like to create an installer for. I have generated the for the directory structure with heat.exe and when I build the setup project it generates an .msi file but I don't think it installs anything.
Maybe someone can walk me through the steps of generating a .msi installer.
Any advise is appreciated,
Thank you
If you're using Visual Studio:
Install the WiX Toolset V3 Visual Studio plugin.
Install the Wax interactive editor.
Build your project if you haven't already.
Add a new project to the solution containing the project you want to create an installer for.
Choose the template Setup Project for WiX v3.
Name the installer. A personal convention is the name of the project plus ".Setup"
A Product.wxs file will open up. Change the Manufacturer="" value to something like your company name or your name. Keep the file open.
Go to Tools -> WiX Setup Editor
On the left under Root Directory choose InstallFolder
Under Projects to install, choose the project you want to install.
In the red area to the right, you'll see a list of files. These are the output results of your build from step 3.
Click the plus sign next to files you want to copy. They should turn white and change to a Resolved state.
This might look daunting, but you're just telling it what to copy--which would be your project's executable, configs, dll libraries, and images it's dependent upon.
You typically want to copy everything. If there are dll's you know you don't need, it's better to remove them as a dependency from the Visual Studio.
Notice the Product.wxs has changed. It now has the files you checked off in the Setup Editor GUI added to the <Wix><Fragment><ComponentGroup> section. Save that file.
Close the Setup Editor.
Build the setup project you just configured.
Open Windows explorer and go to that project's bin/Debug or bin/Release folder, depending on what mode you built in. There you'll see the .msi that you can copy to where you need.
To make an update, make the necessary changes and then change the version number in that project's Properties -> Application -> Assembly Information. Then also change it in Product.wxs <Wix><Product.Version>. Then just build your setup project again.
Good tutorial here:
http://wix.tramontana.co.hu/
http://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with
They should get you started.
If you learn something about the MSI log that will also help - install the MSI with a command line that includes /L*vx
And "doesn't install anything" should be easy to check - are there are any files installed, or did it create an entry in Programs&Features?
WiX is a language (XML/XSD) that serves as a way of authoring (compiling) Windows Installer (.MSI) databases. WiX doesn't install anything, MSI does.
I maintain an open source project called IsWiX. The concept is simple. IsWiX provides additional WiX project templates (scaffolding) and graphical designers to assist you in creating installer. Then as you gain knowledge of WiX and MSI you can make additional tweaks of the WiX XML by hand and go beyond what IsWiX currently knows how to author.
Here's a video showing how to author, build and test an MSI to deploy an IIS website in a mere 3 minutes.
Update: IsWiX has tutorials now.
After a few 'false starts' trying to learn WiX from online tutorials I noticed that on http://wixtoolset.org/ there is a link to the book "WiX 3.6: A Developer's Guide to Windows Installer XML". You can buy it pretty inexpensively in E-book form from Packt, or also Amazon if you like the easy interface with Kindle.
I found this book to be VERY helpful with every little step regarding the .msi creation process. The book will guide you to create your first .msi in the very 1st chapter! Granted, you have to continue a little more to have a fully functioning .msi, but given the complexity of Wix, this book is terrific. It may not be for the gurus among us, but for those of us who need a little more help to understand the material it's wonderful. I've seen many posts speak to the 'steep learning curve' regarding WiX and it is a complicated process to create a valid .msi, but this book goes a long way toward making that learning curve very bearable.
If you are using the build system 'cmake', then you can use cpack to generate .msi file by setting the cpack generator to wix.
What worked for me best, was this fantastic tutorial video: https://www.youtube.com/watch?v=6Yf-eDsRrnM
Its best selling points for me was
independent of visual studio version
it describes deploying a .NET (Core) app also
it focuses on what an average app's installer should be capable of (including heat, icon, background image and banner)
you don't have to learn another layer on wix
it gives you good practices on easy package generation and future maintenance
it gives an installer project template which you can reuse: https://github.com/angelsix/youtube/tree/cecd38ea3d5eea11cc75fc0123297ffc3b5e662b/C%23%20General/Windows%20Installer%20Wix%20DotNet%20Core/ConsoleApp1.Installer

Custom Installer with Wix

I'm still very new to Wix so i'm trying to get my head around how it works. There is a lot to it and its a bit hard to get an understanding of it. If my Wix MSI Contains a bunch of patch files. Can i use a Custom Action with extract the files to a temp location, run a patcher, update the version with the patched file version and then run any other MSI actions?
I'm not really sure how to do this in the XML. I Assume there is some sort of execution sequence
Also if this is possible i need a way to dynamically add the patch files to the MSI during the Build. Can you base this on an output folder?
WiX is far better than installshield and the like, but without seeing your existing .wixproj this is hard to answer directly. You can use custom actions to do all of what you want, but it's not exactly the "WiX way", as that would not be easily reversible for a rollback or uninstall. Dynamically adding files during a build is absolutely possible. I must absolutely direct you to Ramirez' WiX: A Developer's Guide for Windows Installer XML. I got stuck building a complicated installer like this, and this book was invaluable.
What I can easily say is that for the patching portion, you can run exec tasks to run the patcher program and pass the patch files you want to run. You can dump all of these to a temporary directory to do it.

WiX version from C# file

All my .net applications take their version from one C# version file.
lets call it version.cs.
How can i make one WIX project set the version according to this file?
I saw :
How can I set the WiX installer version to the current build version?
but it cannot help me because I am wrapping several DLL and some of them may have the correct version and some not.
How can I Bind the version from C# file?
WiX has no support for this. You'd have to write some build automation to extract the version from the cs file and pass it to WiX's command line at build time.
Personally what I do is use build automation to own the build version and push it into both WiX and C#. Since I'm using TFS Team Build there are libraries already written ( TFSVersioning ) that do this for me.

"Elegant" CruiseControl.Net and WiX integration

I am trying to integrate the automatic generation of MSI installers with my CruiseControl.Net installation. I can see how I can manually build an MSBuild file that calls candle and then light, but I need to make it build installers that can do upgrades, so can I use the BuildLabel (or something of that area) to regenerate new GUIDs for the newer versions?
I have already separated out the configurable parts of the WiX definitions, so it might be easier to hand roll a script or something.
Any help would be appreciated - especially working examples!
Thanks (as usual) in advance
Mark
Use Product/#Id="*" to let WiX generate product codes for upgrades. And you don't have to call candle.exe and light.exe manually; use the .wixproj templates to create MSBuild project files that use wix.targets.