Play Video

Create a MSI/Setup package for C# with WiX Toolset

Want to create an installer package with WiX? Get started here.
Read the full article:
Get the sample application on GitHub:


Visit Mesta Automation website:

Connect with Mesta Automation on social media:



hello I’m mikela from my summation calm and today I show you how to make a setup package or run installer for a c-sharp application with a wix2 set so we just have to go to coda Plex or search these others WX codeplex comm we push download I already downloaded the file so we can go on download and launch the Installer this will install the program on Visual Studio so we wait that it checks the update and we can install by clicking it is okay
when you see complete the installation finishes so we just click exit then we can launch Visual Studio once we having visual today we want to install an extension so we click on extension on tools extension and update we search for W a X on a we click on online search on W a X download install fine rest now perfect so we create now a new WPF application for example and we will not do this complicated it’s just to show you how to create installer
package so we check that this works okay okay this is fine we want to create a step package for this application so we want to click on solution right click on add new project we want to check setup package and here it is we create the project and we can leave the name set up project one so this is w IX it’s a bunch of XML and this is everything you need to create your install package the first step is to add the files to this package so we need
to go to tools w IX setup editor this is w 8 we can okay the first thing this is fine we have to check the install folder then we here we click all our assembly now we have one assembly I add this assembly perfect and it says that these files are not mapped so we have to include them in the application ok so and this is everything we need to to add the first application so we close this and as you can see here he added the files of our
application okay so we can just build a project and we will say the manufacturer is missing here manufacture is here so we can just say the automation speed the project we go on the release on the debug folder and we we see that there is a tab file and a step project and dot MSI we just double click on this and as you can see it installed the program so we can check on control panel program and features there should be setup package you know or
my application here it is so where did install the program we can go on see x86 setup project 1 here we find our application is that ok this is pretty basic so how we can customize our application so ok this is the product ID section so we can give a name of the application here then we can get a signer name also here and the default folder we can use also here now we can build and we can just take it on again the InStyler so as you can see
install the application so I can go on Program Files I go on my WPF application and it is another in quick application started and if we go on control panel way to refresh we can see that there is my WPF application and the step project one now we want to create a shortcut on the desktop and on the Start menu because you see there are no shortcuts here okay creating short that is not that simple so we can go to this page and here we will explain
the steps to create the shortcut so basically and give you the full example so what we are going to do is to add the shortcuts on the components of the product so here is a product feature we have the product components and we want the shortcut so then in the directories we want to add the directories of the shortcut so here we have the shortcut the directory of the software then we want to add also the directories of the shortcut and then we
create a fragment that contains the shortcut so we can install this this will probably override our last installed application here we have a shortcut on my WPF application and there we have our second shortcut on my WPF application and again with the Refresh here we have to my WPF application and one setup project perfect now we want to get rid of these we want to install only one time our application we obtained is by assigning a single geo ID
on this field so how to assign a Geo ID where there is a website this basically generates the GID we can copy this and paste this here perfect so now we build so by giving a single UID we will always use this every time you reconcile before with the start it was generating a new gyd every time you were building the project we need to add the dye some dialogues to this install everyone what dialogues we have to add the reference under stop project
so we right click on reference we had say add reference we have to be in the wix2 set folder in the binary so profiles WX binary here we look for WX UI extension that it should be now say double click OK once we would did this search for package here we can add a minimal give you I okay there are many types of UI you can check out for example if you go on this page you see you have five types of dialog set I will show you the basic one the first
one is w IX minimal so we can build okay this is not telling us we were looking for this is the reference we are looking for UI extension here this so we build again this is creating the package so when here we go on the path and this is an arrow because we have it installed now it shows this error because we added the dialogues so we can go and uninstall this now we can execute the sub-project and you see two dialogues and we click finish okay
now we got some dialogues and that’s fine the next step is customize the dialogues to customize the dialogues you need a bitmap and you need a license for all it so I already have the images done they must be bitmap and the icon must be an icon so I downloaded them from internet so this should work so we assign an icon to our application like this desktop assign the icon perfect now we want to assign the icon also to the Installer now to add the
icon we have to drag and drop ok let’s add we want to add the icon on the step project then we want to under some image here and the license this is apology but so – to add the icon do we have to add these lines this is it will assign the icon to the program to the control panel so at least and that’s fine then we have to to assign the banner we want to sign a top banner a background banner and a top one different from the WI expanded one so we
have to assign some variables again near the icon so we define the banner so as you can see the banner the top manner is called it’s a variable color wix1 BMP and it must be a bitmap and we can give above so images installed upon and same for dialogue oh it mode then we want to add our license so okay I downloaded a simple license from internet it was from Microsoft from a Microsoft product just for example so to add a license we have to name
another WX variable this one WRX UI license at the F so again in project D license that RTF we give and we can insert as you see the background is fine with license at the moment so we click on finish and that’s all so we should have here it is and also probably on the on application on shortcuts and also here because assigned before we want to change the name of the installer package in this means to change the name of this file this is the
project 1 we can say we can call it a setup ok so geez this is the name of the file then as you see it odd outputs an MSI file and the cabinet file so what if we want a single file so this is useful if the application is really large and device takes a lot of megabytes but if we want a single file we can just go on product wxs and on mega template we can write and let CA be yes we obtain a single file as you see is everything included here the
functionality will not change it will just instant what if we want another set of dialogues we go on this dialogue we can go on install deal for example so we can use this instant deal on uif instead of minimal get this will tells us that they okay let’s see what happens because this is not enough we have to make the install deal parameterised parametric so let’s on they found out so here is our license and you see that is an arrow because we we
didn’t declare all the fields needed for instantly how we’ll see really fast how to do this by using the documentation so we have to create a directory ID for like this a structure like this so and a property that is parametric so as you can see with property D then we have to create a directory like this target theosis our directories are here you see like this shorty shorty then we Program Files folder then we have to create another directory
that it’s this one and then we have to close it so as you see we can change this folder so here we have test file of course it’s not correct and we can leave we can also change as you see okay let’s see what happens when we run this installer okay we keep this folder this is fine but it will create one more folder inside oh there is too much week on my double PF application and you see inside there is another photon my WPF application because
these are here so we have an instant folder with a my to prepare application in the testify production giveth creates another my WPF application but this is parametric so we can do like this we can replace this and just clean it out we go on our test file and we say that install folder should the interview is parameterize own is not folder that’s perfect is will to fit all so this will let’s change the folder and let’s put it on desktop let’s put
it on the stop okay let folder test we put our application here to see if it works it should be here on desktop here it is our application and there is ok so what happens when we add another project or some resources let’s say I want to add a file ah and the folder add you know folder so let’s add a text file okay so we add another our file a file to our application perfect so in the end we have to say this so we want that this file is included
in our installation so as you know to output order these we usually do content and copy if newer we can also do none and copies if newer this we put put it already but if you want the tab leaks recognized automatically that you have to add this file we have to put it on content so we build the application week on the release folder on the debug folder and you see that we created the files and text file one so when we have two other files like
these or images or everything we just have to go to tools WX as you can see a he recognized that this is there is a folder missing we have to declare this so we just click on plus and the other is a file mixing that it’s a mapped and we have to click on plus so we can close this and go on to the project and you see your solves and we’ll add file again builder okay and the same we do if we add another binary so let’s say we add a new project on
c-sharp dependence we had a reference here you so we’re going the release of multiple if you have application here we have the executable and a DLL of the dependency and again go on desktop editor will refresh and we see that he recognized that that is the dependency on mapped a week ago click on plus will add it so we already and we do an acceleration here perfect so let’s go on profiles we search for our folder and here we go with our DLL and
our files and our application so it’s actually very simple to manage this kind of installation package and this is what I’m using at the moment it’s also possible to customize the dialogues too for example you see URF we just use the pre-built dialogues but if you go on this folder so we go and see Program Files we go on w week’s SDK again UI so here we have for example install deal we can open this as you can see this is a fragment and the
contains all the XML needed and you see exactly dialogues and the and what happens when you click on the buttons of the dialog so it’s it’s really really simple view if you want to don’t show the license for example you see that the Welcome dialogue on next here we click a verify and the nearest liquor license agreement so if you put this to another name let’s say install the dialog you just skip so when you have the Welcome dialog you click Next
you can put extol dialogue here and we’ll just skip this and of course if you click back on inside the dialog you have not to go on Isis agreement but you have to go on the welcome dialogue so these kind of things you have to substitute so while it’s a you can make some practice the documentation is really it’s really good where everything and you can just check on Google for everything you need so hope like the video if you liked it subscribe
and like it and see you on the next video