
Sigma Hosting
Menu
One of the most undocumented things in programming is how to make installer packages, and yet anyone wanting to release an application professionally needs one.
In this video I take you from absolute beginnings right through to a fully automated build of an installer package for your product, complete with icons, shortcuts, 32/64bit versions and more.
References
Wix Toolset: http://wixtoolset.org/
Source Code: https://github.com/angelsix/youtube/tree/cecd38ea3d5eea11cc75fc0123297ffc3b5e662b/C# General/Windows Installer Wix DotNet Core
Latest Code: https://github.com/angelsix/youtube
so in this video we’re gonna make a installer for Windows so the first thing we’re gonna do is we’re gonna make a dotnet core application because there that obviously the modern think it doesn’t really matter what the application is it’s about showing you the installation process in this case so just going to make a console app from new and then we’ll just simply add just a console dot readline to keep the application open and then we’ll
just compile it with f5 to make sure this runs ticking is a hello world and then you press ENTER to close the application so that’s all we need for our application if you will that we want to distribute come at a full screen a minute to get these sides up and then now for an installer we want to first no have to go to the internet and download the Wix installer so we type in WIPs install or Wix installer you’ll get to Wix toolset org and go to
the downloads page download Wix 3.11 or whatever the stable at the time and then install the Wix toolset extensions as well and then restart Visual Studio if during the install process you get prompted by Wix to say it needs dotnet framework 3.5 then open your Start menu and type feature start typing feature and you’ll see turn Windows Features on or off open this and then the top entry is this framework for people in five you simply check this
box and click OK and that will get Wix installed then in your solution to you know the product you want to make an installer for just right click add new project and then in here now you should see Wix tools that make sure it’s like version 3 not and then I typically called the Installer the same name as the application so in this case it’s console a porn and then docked Installer you can call it whatever you like well that’s my convention and
you’re doing the setup project for Wix v3 so click OK to that and this will add and install a project then you can right-click and build and you should be able to build a blank project the product manufacture type it cannot be empty ok so just before you can build we have to at least specify a manufacturer so let’s just get started on this and and add some basic info and then we’ll get it compiling anyway so if we start with the the product
itself the ID is basically a unique identifier for this product which will identify it from you know any other product out there so we basically want to do it for this but we’re gonna make a 32-bit and the 64-bit version of our installer and our product if you will so instead of just being a GUI like we have here you know pasted in we’re gonna make a an eval statement so to do that in Wix it’s angle brackets question mark and then if and then
angle brackets question mark else I’ll back it’s question mark end if and that’s the you know a leave out statement basically and then in here we do question mark define and we’ll so we’ll call it product codes this is making a variable and then product code equals and then whatever the value wants to be otherwise another value and then then he will do tools create gooood registry format creating new one and copy paste it in there new one and
copy paste it in there and make sure you do this don’t copy these exact ids make them yourself each time start give us a product type product code as a variable and obviously the if-statement need to actually specify when it’s a 64-bit honor so to do that to access the effectively this drop-down here of what configuration we read what platform where these values we need to do a dollar sign so to access variables it’s a dollar sign and open close
brackets var dot and then the name of the variable and this is a built-in one into Wix so platform platform is a built-in variable that will match this exact text here so any CPU would be the text right now and if it says x64 we’re gonna presume in fact you don’t need the the quotes around it you can simply do you know directly like that so if the platform is x64 then this will be the ID for it otherwise it will be this and then same as how we’ve
accessed the built-in variable here with var platform we can now access it in the ID so we’ll set the ID but this time to var product code so we first checked a variable everything equals 64-bit in this configuration and then we’ve made a variable we’ve defined one called product code and give you two unique ones based on 32 or 64-bit and then simply assign that to the product ID and so that’s the first little bit the name will be the name of our
installer so we want this to be the actual name of the product but instead of simply you know tap your name here we want to put this in another class similar to the way you pull up but you know different things in different classes and different files and c-sharp so well because this is going to be a string and again the the name of the application you might change when you come to make it for different languages we’ll put it in a localization
file so right click on the installer add new item and then the little annoying thing with Wix now you’ll notice you want an localization file but we notice up here it’s made of v4 default selection not v3 even though we’re in a v3 project so make sure you click v3 then localization file and then we’ll just call this common in Kali whatever you like I just call it common and this will give you another file and then here you can see it defining
strings and it’s basically a way to store localized string so strings that are different per language and we’re only got gonna have English in this example anyway but it’s it’s setting up the project correctly for future change so and he’ll give the variable name we’ll call it product product name and for 32-bit and we’ll call this console app and in brackets 32 bits that’s what we want to show in the Installer when they’re installing you know
the name of our product and when it’s 64 bit we’ll say 64 and that’s now a variable it’s a localized babe also you access it slightly differently but it’s it’s still basically a variable so what we want to do here instead of having the name you would maybe think that you do var dot and then a product name like that similar to here but this isn’t a variable a localized file they’re not exactly variables are such the localized the localized
variables basically so you access them differently so instead of a dollar sign you do an exclamation instead of the word var you do a low C short for localization and that’s how you now access a localized variable name but the difference is similar to the ID code we want the product name to change based on the platform and you can see we name these this way for a reason because this is the name of the configurations here will be in a minute we’ll
add x64 and will remove any CPU so we’re looking for this exact name x86 or x64 so then instead of having the direct text there to pick the variable of product name we can literally take this platform name which will be either X 60 or x86 and we place it there so we end up with this string so now this string will be the name of the basically we will pick one of these two based on the the platform that we’re in the language is again that’s gonna
be C the language is going to change we’re not sure where we’ll change it yet you know when we come to do installs for different different languages so we’ll just leave that in for now and then when we get to do in different languages we can basically change this I guess we could chuck it in our localized string for now as well so we want it to be 103 3 and then we could actually compile against I guess a certain language afterwards like based on
culture and have multiple includes or something we weren’t do that in this video but again we’ll set it up ready for words so we’ll say this is language and then to access that we’ll do the same as we do here where we access a localized variable but this time it’s just language version we will access will create for now we’ll simply define the variable called say build version and was a setup to 1.2.3.4 or something this will change but just so
we can get the product building we’ll use that for now and then what we will do is actually pull the version number from this app like you know our actual project so in our console app we’d pull it from package yeah packaged in their assembly version here so this is the number we gets and when we do change our product you know it pulls in with the real thing we don’t have to keep editing a build version and the Installer he’ll simply pull him
from the actual file but for now we’ve just linked it here manufacturer as myself so again a localized string and we’ll call this one company say and this is angel six and then in the manufacturer we can do localized variable company that we’re pulling that let’s upgrade code basically this upgrade code means when you have you say you install version on 1.2.3.4 and then we will expose from one point five or something and when you install it on
Windows you’re able to auto detect it as a previous version or a higher version of the current thing installed and if there’s a higher version you’ll get this or great error just below and if it’s a higher version then you can make your installer forcefully uninstall the previous versions you know so it never it just removes an automatically upgrades to the next version so all you want to do for that this ID should stay the same throughout all
versions of your product this is effectively your real product ID of you will these product ID is you change every time you change version number but this is the thing that never changes so that all installers of your product can figure out you know a single ID to know if it’s a new version of a same product so you keep your gray code the same every time and we will want a variable again like product code and we’ll call this one upgrade code and
then we will just define one outside of that a pal statement because it doesn’t matter which platform in this case it’s gonna be the same you know the same code as we mentioned so I’m making you gooood and we’ll paste that into there and we’ll call this one off great code what’s next so for start with now we’re going to manufacture I guess that should build I was being duplicated Oh I copied and then remove the other one put the 32-bit back in
there now it’s built successfully we open the folder to the Installer you hope to bin-debug en-us and here’s our installer so if we double-click this you can see says console up 32-bit and nothing will happen because there’s no files to install so this thing will basically pop up with a prompt in a minute and then I’ll click yes but it won’t install because how it was cancel this out it won’t install because there’s nothing to install yet but
that shows that the name was correct let’s just quickly fix these configurations so in this drop-down click configuration manager if you don’t see that for any reason right click the solution and click on very variation manager and then here is the solution platforms so I’ll click Edit or where’s the add I’ll click new then in the drop down the new one we want is x64 because we don’t have it and we can copy settings from any CPU it doesn’t matter
and click OK and now we have 32-bit 64-bit at any CPU so now we look at it and remove any CPU will simply happy the 32 or 64-bit explicitly and then in this drop-down you can give 64-bit and your application you’re done at core could stay any CPU that doesn’t matter in this instance and the installers x86 in the installer they would drop down though and click Edit or rather now but new and make 64-bit just the same as we did and I’ve noticed this
also seems to be an issue it doesn’t want to add so in order to get sixty four-bit we’ve now got 32-bit and we also don’t want to build the Installer every time you build the project so we’ll uncheck that and then the 64-bit version now we simply need to get this to actually have a 64-bit version so if we right-click on the Installer unload right click and edit you shouldn’t have to do this because it should work but obviously visual studio and
Wix on working together right now probably would seize issue because it’s very outdated you’ll see these and the Installer these two property groups here with conditions and they state when there’s release or debug specify these values and that’s all it needs to force a a configuration for the 64-bit so we’ll take both of these so these two 32-bit basic information about the outputs will copy them and paste them below so you now have four and
we’ll simply change the bottom two to 64 and nothing else needs to change do you save and then right click and reload the Installer and then solution right-clicking configuration manager and go back we should see 64-bit now so you might get that bug in Wix I’m pretty sure you will because I have so that’s how you forcefully add a 64-bit typically you just click a drop down here click new when you can add and it works so we just force that to work
so now what we’ve done that is our solution now can either be 32 bit or 64 so now is 64 bit if we right-click on the Installer and build should build successfully still but now what we should find what we should find is this product code here should have selected the 64 bit version so when we open up the install or when we try to run the installer this time we should see 64 bits that you so we now have a 32 and 64-bit installer that at least
picks up the name of either the 32 or the 64-bit values and we have it building successfully so now we need to move on to actually you know doing something with this so we’ll move on to the package which is inside the product so you’ll notice if you collapse product now you down to there’s your product which is going to contain all the information about the product all the files to install everything else and then outside are here which we’ll get
to after is the folders to create and the files to actually include so inside a product is your package now the package we need to specify a bit more information than we’ve got so we have right now install the version 200 is fine just leave that standard compressed obviously compresses the installer to make it smaller which we also want install it see the per machine or per user like you get on most installers so we’re going to install our
application across the whole machine no matter which you know user installs it which is the most common as well so it goes into Program Files and it’s accessible for all users but we want tried a few more things that’s you know makes it nicer some details that we want so one is we want to put the platform in so it’s at least knows the platform we’ve got that variable so we should add it just as an extra you know piece of information then we have
manufacturer again we’ve got that information so we’ll add it and that was called company as in the localization hope that localization is wrong there like this we need an exclamation for that manufacturer is company then we will have basically all this information if we went to uninstall and control panel and we looked at programs to uninstall basically when you click on them you’ll see here product version size other ones like Dropbox they say
has a version a website link help link all this information is what we’re adding at this area here the package so in order to get all that we’ll have all our description so we’ll do description we’ll make that again a localized string it’s that will be description you’ll have keywords again you can think of this as just a useful way for whatever install or whatever you know anyone inspecting the installer file will see all this you know these
pieces of information so it’s just good to have in there you love comments which is really again like descriptions but you know you can put whatever you want in comments and then so a lot those three so if we just copy and paste three times who wants description comments and you don’t need to add these this is completely optional but this is similar to no putting comments in your code something that recommends you don’t need it but I’d highly
recommend you know adding all this information it just makes the product nice so as more details about it you know and it helps the end user basically so description this is a really bad one this is a description just to get the point across but you describe your product they’re obviously comments I guess you’d use either I don’t really know it’s whatever you want to use them for descriptions obviously your product description comments is going
to be you know I guess what it stands for really just general comments is not necessarily directly describing the product but it might be something after thoughts or notes there so we’ll just say some comment in this case and keywords will say dotnet core application installer a couple of key words go in there so now these law get picked up we also have again a language language ease because it can beat multiple we’ll just insert our single
language for now just from the localised resource again and I think that’s all we need for you know those details major downgrade message a new version of products this should that again be localized because this is in English and when we change it to a different language so we’ll simply cut that out and we’ll say localized or downgrade downgrade error message will say and then we’ll make another localized setting and this will be downgrade error
message and the value will be a new version of and then our product name it’s gonna be console is already installed that’s the error message that I mentioned when we come to try and install a lower version than what’s already installed this is the error message they’ll get media template the media template is when we package this installer to the MSI file when we start adding our console app files to the installer they go into a CAD file
basically it’s like a zip file and this media template describes you know what names to give that cab file how to package it whether it you know gets embedded in the MSI file or not and that’s basically the information the only option we really care about for this is make sure we embed the CAD file for the while end up with an MSI file but then also you know a cab file that you’d have to you know ship with the MSI file which is not very nice so
if you remove that you’ll see when you compile the application you end up with like a cub file as well so all this is kind of just defining information right now so it’s quite a bit of setup but again once you go through this this is all ready for your most copy and paste in each time you give it installer and just changing you know yeah your descriptions here so just bear where they can work through it I know it’s kind of you know a bit boring
to just go through and start adding build numbers and you know names descriptions but it’s all part of the you know the setup of this so we move on to the final part of what’s in a product you know inside the product element and that’s the feature so the feature contains everything from the files that you install the Start menu links if you make those the Program Files folder any other folders that you make or install things in so the basically
everything that the Installer does could be registry entries it could be setting up firewall rules it’s it’s whatever it’s basically everything in there so we’ll just call this product feature will leave the IDS product feature the title of this sure we do ours us we’ll just call us console ah it doesn’t really matter I mean this gets shown anywhere and then in here what we have you’ll see is like say this can be now files it can be registry
entries it for me whatever and you can define them directly in here but what you typically do is you know referencing it instead so instead of defining files directly and only a big list in one file we say we want the components to be installed but we’re talking about a group of components so in this case it’ll be a group of files and shortcuts and things and it’s called product components and if you scroll a bit further down you’ll notice it’s
it’s here at the minute it’s in product components this is a group and then it gives you a little bit of comments about this is effectively where you add your files and your registry entries from blah blah so we’ll leave that called product components and we know we simply need to make a product a component group with the ID that matches so this ID matches this ID and then we’re good to go we can add files to this installer here but we won’t add
files here we want to clean this up so we’ll cut that out right click on the installer will do add new item make sure on version three still again and this time we want to make directories so for making a directory you’ll need to have again the same low not localization but I’ll need to making new installer file which is the same as the product file WX s WX s so we’re simply moving it’s like making a partial class if you will or simply another
class and see show up simply splitting out all the information across multiple files so it’s easier for us to find and we’ll call this one directories because that’s what we’re gonna put in this file and then in here or simply paste the bit we cut and also we’ve done is shifted the components out or rather what my saying when the directories is what we’re gonna move to in a minute make another one add new item installer version three this one’s
going to be components so we’ll paste that again into the components one and then as always kind of getting ahead of myself there go back to product you’ll also see the folders here is another fragment in the product wxs we’ll call that one and we’ll paste that into the directories one which is what we’ve made so now we have components with the components in ready to access directories with the default directories in there in this product file is
now almost finished so we’ve got to actually add the directories and the components the files to the Installer but in terms of the product we’ll just add a few more things so one will add an icon so that the Installer has an icon in the add/remove and then we can use the icon for shortcuts and things so you can place it anywhere but I’ll place it say between the media element you simply type Open bracket icon give an ID I’ll say it’s called icon
der iCub give it a lowercase and that’s just to see it’s easy to remember you kind of think what’s the main icon to the application or I’ll just call it icon iCup just an ID so you can name it whatever you like and then we just have to say source file and tell it where the icon is so we don’t have an icon yet so in our application that’s going to right-click and I’m just gonna say existing item and I’m gonna pick the icon from others put my angel
six icon don’t have to drop down this all files and we’ll pick this green icon you get added to our actual product not be installed a gets added to our product you know our whatever program we want to install I’ll just rename this to ICO this is the app icon and now we just need to reference this to the project files so in order to do that in the Installer just like any other project when you want to reference another project we need to
right-click the reference isn’t add and then we need to go to projects double click the contour app and then it’ll appear down in this list and click OK and now we get a reference to the project in the Installer so in order to get the path of where this console application is so we right-click and open in Explorer this path right here which is where the a pipe is in order to get this path we have to do it’s a variable just like we do bagel starts
dollar before dot and then to get the project directory your type project dir but what this orga is the project directory for the Installer because this is the installers files and so in order to get the project directory of another project you simply have to put bar dot than the name of the project first from this case console app one and then dot project dir if your project name has got dots in that’s fine so if it was console dot dot one they
need actually tie just console dot dot one dot project out if it doesn’t matter it will still work that way so that’s how we use an inbuilt variable to get this directory so we’re now in the console app directory it already has a trailing slash like that on the project directory but I still aren’t one anyway and then the optical and the reason for that is if you remove it I tend to find that the name of the file blends in and looks a bit strange
so just for visually being obvious and clearer I put a you know a backslash here so this should now link an icon to it should find this icon basically and this is just been a deed as an icon it’s not being used it was simply been created that we’ve linked it and we’ve now give it an ID of our icon dico so in order to add that icon to the Installer so it’ll show up in the add/remove programs and be used you know it’s part of the installer we need
to do we need to make a property and the ID in this case is actually a hard-coded ID so by simply typing the exact right thing whichis app and what is it what’s for the icon I think it a product icon and that is a you know a special ID that the Installer will pick up and then the value of that needs to be the ID of an icon so in that case it’s this ID so that should give us the icon we can start commenting here so use the icon ICO icon for this
install close up in as we moved programs let’s go back up and common these so give product a unique ID per platform fixed upgrade ID bill versions temporary because we’ll move that so I can stay define main product provide package details downgrade error message include drop cab file into the MSI file this is defined main icon use app icon for installer define components shortcuts bios etc for install so that will now use an icon the one other
thing we haven’t defined here in the package for the ad we move details is if you noticed when I went to the uninstaller some products have a website to support link and a help link so you’d expect to do it here in the package details but instead you don’t you do it similar to the icon so the icons part of the ad we move thing so copy and paste that and the other ID for the link I think it’s a Perl info about because it’s the info and and about
link if you will it’s the support and the help and this is the physical website you know over your product so we can put this into a a variable or could move it up here so it’s easily defined but to be honest I was put here for now just to show you that multiple ways of doing it still do angel 6 calm and that will be in the add/remove programs so i’ll support the website those in the and remove programs and then what else is there so let’s check
we can still compile this which we can and now if we open this up one thing you’ll notice is for an installer I know it’s not installing anything at the minute but still this opens up and then just goes away there’s absolutely no UI and that’s not because we’re not installing files it’s simply because by default the Installer is set to basically have no UI so that’s also just to add some UI to this installer all out of basic terms and conditions
page and then a next to install and to do that those built in you ice by you our templates if you will to Wix and to define that you’re tired URF and then we have again a special ID similar to these product property IDs a special ID for the basic UI is which you i underscore minimal i think and then this is good a basic UI for the installer this UI isn’t stored in Wix by default again just like c-sharp applications so you wanted to make use of
jason net heat after out of reference to jason net in the nougat puppies so similar to the UI to use this which UI we need to add a reference to the which UI assembly so right click on the references add references in the Browse drop-down go to Program Files xx t8 Wix toolset bin and then I think it’s in here which UI extension double-click that DLL click OK and you’ll see now we’ve got a Wix UI extension here and that should give us now basic UI
so if we compile the Installer again and run the installer we should see some basic UI so now when we click install we got this pop up the this being like you know black and the outside being why it wouldn’t happen on your machine it’s because I’ve got a dark theme on windows so this would look nicer but the key thing to point out here is we have a place to put our license we have a place to put our logo and then when we click accept and install
this will go quick but you’ll see a top banner as well so you see that top banner with the little white and then the red icon so all three of those things we can customize in this UI so we might all go ahead and do that now so to customize the banner on the left and the banner along the top we want to open up the install a folder create a new folder called assets and in this folder we will place two images that we can then reference so those are
going to come from I’ll grab them from my DNA web installer and we’ll go ahead and grab these two things so these are two bitmaps that’s all they are so if you want to make bitmaps make them however you like paint folk to shop whatever program you want to use the background is the left image and the key thing here is it’s got to be a bitmap that’s 493 pixels by 312 and the Banat is going to be 493 pixels wide by 58 down and you can see these two
are basically you know put like a green background there and then a green banner so you’ll get this in the source code the links will be in the video so you can simply take these bit much and edit them yourself but basically make an assets folder in the installers project plunk them in there and then we’ll link them again with the property like a unique property the same way we’ve done this but this time because it’s in the which UI assembly we
type Wix variable size of one thing that does me head in with Wix there’s so many different ways to define things and you know you’ve got properties you’ve got you know defined you got localized variables you which available so it’s kind of annoying or just go with it luckily most of this is you do it once and this installers good for nearly every product you make you have to make very few changes so you’ve always got this as a reference then so
wicks variable is what your time again ID is going to be a special case ID to replace the main image on the Left which UI dialogue bitmap BMP and the value this time we want to be we mentioned the product project directory before where they get this installer project directory if you don’t specify anything so paste that into the value remove the console dot one and just simply put var dot project dir so that will get this installers folder which
if we open up in Explorer is actually the one where we’ve then got assets and then background up the MP so then we do backslash background assets background bitmap I think it’s a PNG just cut here then copy and paste the Wix UI dialogue fitme and change it to finer bitmap and that’s the one that goes along the top and change the name to banner so basically these two should link into the the background images build the Installer again and we’ll
check that you know check as we go that’s built sort of quickly out of comment change the install at UI background images I open up the project go to bin-debug run it this time and now you can see we now have our custom bitmap here and when we install we should see a green banner which we do so there’s the UI done now as the last step is getting this installer install getting this license text here so for that I would recommend a product I don’t
know whether anybody writes in markdown probably not many of you but it’s a you know cross-platform document standard a real document formats and you know making Word documents with headers footers quotes tables things like that it’s writer and write everything to mark down so it’s cross-platform so for that I recommend type or you can see you type typ o ra it’s a really nice clean markdown editor and I’ll do videos on markdown eventually but you
can easily google it to find some basic info we’re just gonna make our rich text documents in the the RTF file that it needs for the license using this in markdown and then this can export to rich text format because if you use word to make rich text format and you look at the source code of it you open it and save es code you’ll notice word add a huge amount of bulk to a rich text format file so it’s no good so I’d use this type Ora to do a
title we’ll just put a hash a space and then we’ll say my license and then when you press ENTER you’ll see it’s gone to a title yeah this is my license that you must agree to and then if you do star star or out star star that will go bold again these are all just markdown things you can you can just google for until I get time to do a video on markdown we do an arrow it’ll do a quote so basically we do you know a greater than sign and in space it
visually shows us a quote there’s a world and another quote and then we could do some link and let’s do a link you do square brackets and normal angle brackets and angle brackets parenthesis in the square part you put the text so some link this will go to angel six and this could be a link to say your license online have you wanted to rattling and then then the parentheses you put the actual web link and then little you know loot like that so
similar that a website HTML document blah blah and whatever else you want in your license you’ve got to save this file first so save it go to desktop or whatever you want and save it as a markdown file first and now if you go to export you can export it as rich text format if you don’t save the file first and you do export as rich text format it won’t work correctly so we now export as rich text format and we can close type Ora and now we can
copy this license into our installer assets folder and we’ll call it license and now in here the same way we’ve linked these two just copy and paste again which UI license our TF is the key word there this will be license dot RTF build the Installer again and now we should have the license file so we should have you know what we wrote as our license so let’s go ahead and open the folder and check if that works assets bin-debug en-us install now
you can see we have our license we’ve got the bold text we’ve got the quote that’s indented we’ve got some link in the in still the text and we got the blah blah so you can define your license then so now we have the name of the application please read the license you’ve got to agree you got your banner you’ve got install and got your other banner there so we’ve now for the most part got everything we need in terms of you know where you know it’s
the structure of the installer with all our kind of UI involved and everything there so now we really want to move on to getting the actual dive actress and files so if we quickly open the console up folder and this will be different to be night and still in dotnet applications but to install a dotnet application or rather say you wants to install the.net framework before dotnet core come out you know a normal C sharp application you’d compile
and this would be what you’d you know in your bin debug would be what you’d effectively you know install it’ll be in release format but you know to be these files but in dotnet core you’ll notice this is a console app yet there’s no exe and that’s because dotnet core you can run the DLL directly because it’s cross-platform Linux doesn’t know where any XE as Mac doesn’t know one exe s so you can’t provide the dotnet core application in exe because
that’s a window specific thing so they go to dot DLL and then they’re invoked by the dotnet framework on that machine so if we go to the folder for example here where it’s compiled and then the address bar we type CMD short for commands and press ENTER it’ll open up a command in this folder and then the way it would run when we press f5 it basically says dotnet space and then the name of the DLL file console app one DLL and we press ENTER and
there’s our application running so that’s how it would be invoked you know because there’s no exe but that’s not really very good when you want to actually distribute it specifically to Windows or specifically to Linux because then how’d you run the application the user doesn’t have net SDK on that machine and they certainly don’t want to be told to go to a folder type dotnet space and the name of a DLL that’s just not what you do so in order to
create the files for a dotnet core application that are usable on another machine you know the end user what you want to do is go to the the root path of the application you know where your or go up one where your solution file is to SLM go to the address bar type CMD and what you’ll do is you’ll publish the application so your type dotnet space publish and then for an example we’ll do – which stands for run time and we want this on the windows
x86 which will be a 32-bit and before we press ENTER let me just jump back into the bin-debug folder and I think it’s yeah then we go into that one and now I press ENTER on this dotnet publish win x86 should compile my application and you can see there it’s now gone and there’s a win x86 folder we go into that folder go into the publish folder and you can see this is now a completely self-contained application we’ve even got an actual exe to run
and if we double click that exe we get our application so now this is more like a conventional dotnet framework up we can basically take this publish folder here and we can put that on any machine even if it doesn’t have dotnet core installed so we can just plunk it on a brand new Windows 10 machine and windows 7 machine windows 8 machine anything you like and this is completely self-contained and what all these files are all these deals this is
dotnet core so this is the dotnet called runtime included or part of the runtime basically everything that your application is referenced so all these files get installed and then you also have your console specific like your application specific files here and the key one here is now the executable that can be you know ran to run your application so you can think of this as the dotnet called runtime and your application all in one folder so this
is what we need to install in order to you know have our protocol running on the machine and also to generate that we need the Installer to run you know dotnet publishing that the correct platform the 32 or 64 bit publish but that’s how you do manually you basically go to the products foldaway solutionist and then run a command line and your type dotnet publish – off a runtime and the specific room time you want so you can generate runtimes for
you know Linux so I think it’s Linux again actually something like that and not Linux x86 what is it maybe it’s Linux I can’t remember is there a Linux arm looks like this maybe on an exam one so that’s you can do for all the informations online you know for Mac which things OSX you can see there Linux arm publish and this is something that comes on Linux machines so you have all of your you know you’ve acquired files and this is your executable
in Linux which is not got a name let’s have a look at this out of curiosity this is compiled binary but basically this is your executable that you’d run in Linux so that’s how you’d publish to whatever platform but obviously we’re interested in publishing to Windows 32 and 64-bit so they’re the steps you need to run manually or rather automatically in the install and then we also need to install those files so the first thing we’ll do then let’s
get get the components going so in the components we want a component group which we’ve got called product components that’s fine we don’t want the directory specified here not in the component group will remove all these comments and then in component group again and we’ll now reference specific components so we’ll do a component ref and as we mentioned we want to install specific files and in essence we need to install all of the files so all
those files we just saw in the bin debug and then the publish folder with all those files in we need to install every one of those so let’s just do one as an example to get this installer working so you can see everything but then also need to do without all the other files it will pull this test file and this is a reference to something that gonna have test file as the ID so then in order to install a file you need to know where it’s going to go
so the components is going to define a reference that says we want to install test file but to a specific folder and then we obviously need to define that folder so let’s step over to the directories first and the directories now has an ID of target dir which is simply an ID we’ve given it and sauce dir so there the standard sorts leave them as they are there yes get some space you know that’s the master directory simply leave that as is that’s
you know doesn’t actually go anywhere that’s simply the the primary directory ID and the next one in Program Files folder is the C Drive and then program files or Program Files x86 depending on which one we’re running us so we’ll pick one of those that’s a special key special ID again so this is basically saying the Program Files folder and obviously again we need to go into a specific we need to either go into the 64-bit folder or the 32-bit
folder based on what platform run and by default this is a 32-bit folder so just like we did before do a question mark if darling folks let’s be a little bit lazy go to product copy and paste this statement and paste it in here so we have a 64-bit or 32-bit we’ll cut this one into 32-bit so there’s the 32-bit folders or paste it again into the 64-bit for now and then we have to clear defined 64-bit folder and 32-bit folder and also we need to do
for the 64-bit folder to be correct is do miles 64 folder and again that’s a special ID which will find the we’ve got a lot stuff open close these down so the Program Files 64 will be this folder Program Files Program Files on its own folder is the 32-bit for that’s what these two are now going to point to and then all we’re doing inside that is specifying we’re giving the directory an ID and this is now another directory so again if we open back
of this and went into Program Files you can see things have their own folder so we want to add a folder in here for our application and we want to give that a name so again and here the name we will put in the localized folder at localized strings we’ve got product name here but we don’t really want to see we don’t want that as the name of the folder we want it simply to be probably console app without spaces so we’ll copy and paste that we’ll
call it product name folder product folder name is probably a better barrier but we’ll leave it as that we’ll call this console or you could give it their you know the name of your company first and then you go into console app but for now I’ll just say console app it’s fine so we’ll just reference this product name folder instead of the name there so the the banging symbol the exclamation lock dot and then the name of the localized variable
paste that into both and what this should do is now anything we then say any component we make we have to tell it what directory that the files going in so we’ll say install folder is the directory and that will basically then plunk into the program files inside a folder called product name so that’s gonna be you know where the files will go then or else is left we have or we will have we want a short cut to this program as well so technically
the short cut folder it’s called the program menu folder and that’s where all these no shortcuts go I don’t know they can open the folder here to show and open file location’ so you can see this folder here this programs folder which is program data marks off Windows Start menu programs you place a short button here it will appear in your Start menu so this folder is called the programs menu folder that’s that you know the technical name is
programs and it’s the storming since the program’s menu folder that doesn’t change based on 32 or 64 bit so in order to get a folder and obviously get an ID to that folder so we can play shortcuts in there we’ll make a new one so Start menu directory will use a special ID first to get the program menu folder and that’s it we don’t need to our names that’s just a special folder and then inside that similar to the Program Files folder as you saw
the shortcuts folder house subfolders as well to them place shortcuts in so when you open this up some of them do some often just place it straight here so these aren’t them folders but then like a Cronus is in a folder and then your shortcuts go in so we’ll make a folder as well for our shortcuts to go in so we’ll make another directory with an ID and this is the ID we make up now we’ll call it whatever we want so I’ll call this install program
menu folder if you’re calling shortcuts menu folder call it whatever you like this is the ID you make up this is the special ID that finds the Start menu in the first place so we’re gonna call it install program folder menu and the name of this folder we’ll use the same thing again we’ll use this product name so it’s a no spaces follow the name again you’re free to use what you like so this is all of our folders set and this doesn’t make folders
of Xochitl it will be made as soon as we add a component to them so all we need to do now is install all of our files into the install folder which will be the correct folder based on platform and we’ll install a shortcut into the installed program menu folder so we’ve got the IDE the three IDs for the two IDs we need in the directories so the only thing left now is to you know make the components so as you mentioned we did a reference to we made
a reference ready called test file and now we want to make that test file so to make that test file we will will stay inside this fragment it doesn’t matter and we will have as we mentioned we need to say where the files are going to be installed so this time we’ll do a directory Ref similar to a component ref to now reference the directory we’ve made here we want to go into the install folder so the directory ref will have an ID of install
folder and then inside here we’ll finally put a component which is going to have our file inside of it and we’ll give an ID and the component ID which called test file here and again each file every single component rather depending on whether it’s a file or not needs a unique ID so we’ll do generate compute again oh I don’t know got copied up generating that copied and then paste it Kiwi damn so you’ve got a component with an ID which is now
linked and a GUI and then in the components we’ll finally add a physical file so the file I’ll need my ID as well so we’re just doing test file so let’s just go ahead and generate them all open folder go up one folder CMD we’ll do it manually for the moment so dotnet probably or Winx 86 you won’t have to do this at the end I will make the Installer run this for but just for quickness we all want to install publish let’s just install doesn’t
matter this top file so it’s gonna have that name so the ID of the file will just say file test file or simply prepend it because this is the component called test file this is gonna be a physical file so I’ll give it that ID again this is just a temporarily show you the name is the actual name of the file because it’s gonna look in the install folder in fact yeah that’s the install folder and what we’re missing where we’re looking so this is the
folder we want to install into the Program Files folder but also now all these files how does it know where this file is we’ve give it a name but we haven’t told it where it’s installed which is you know in console app bin-debug net core app to win x86 publish all that path you know isn’t isn’t there basically we don’t have that we don’t know that and so we need to tell it where that folder is you know in the in a variable really so we want to
define a variable that generates this base path so again for now let’s just Chuck a well let’s let’s type it in for now just for this demo so in the directory so everything inside the directory the file source of all of these files we will want to create you know the path so well the path that’s gonna be it starts out I believe the installers path pretty sure it starts here if you don’t specify a source it’s kind of looking here for files so
based on our project this might be different for yours we start here in order to get to the bin folder of our where our files are we need to first go up one folder two here so let’s type that in so that’s dot dot backslash we then need to go into console app one so we’ll go into that folder then it’s bin-debug so it will be been debug and then net caught up to point O and then win x86 which would obviously change per platform so it would be win
and then instead of x86 it would be odd platform just pick the correct one and then backslash in debug corner tap when it’s it’s and then it’s going to publish so publish and then backslash and then that set within that folder so we defining that this is the place we’ll we’ll move this to an actor well we really move it to a nicer place we’ll simply move this when we come to do the final installer but this is showing you how to now every file
that’s inside this directory ref inside here we’ll this is where it’s going to search for it and you have to find that path based on your application so you know you have to basically you start in where your installer dot which projects and you do the relative dot dot steps up a folder and then we go into this folder name and this then you’re physically just telling it the you know the relative path of how to now find all the files that you want
to install so this is the one file we’re going to install for now and that’s all we have there and then what else do we need and then key path which basically just set it to yes and this I forget why we do this in Wix it’s for supposed to be a key path of its parent oh I think it’s simply the component needs you get your component multiple things in it but it needs at least one ID one key thing that makes it you know a reference to that component
what’s the physical reference what’s the key to that thing so we’ve only got one file per component that’s how we’re going to do it so it doesn’t matter so simply all of them get set to keep at the ass each time so for every file you have that you want to install which would be every single one of these and there’s 215 of them we would have to do this 215 times with a generating GUI for each one and the name of each item and you can do that and
that’s how I used to do them with dotnet framework 20 lot like you know 10 maybe 15 files to install but obviously with dotnet core it’s installing the whole framework you don’t really want to have to manually do all of that for 215 plus files so we’ll show you a nicer way to do the you know do that automatically but you need to understand you know where where it gets added and how and why so that when we generate it automatically you understand
the whole linking of everything so if we just compile this first and let’s check we should now get a full working installer there we’ll install everything so there yo system can’t from file control up one bin-debug so console up bin-debug net core app 2.0 win – x64 obviously because we haven’t you elevated it yet so let’s just manually generate the 64-bit for now until we add that automatically CMD dotnet publish or win 64 bit and then let’s
build again the directory install program folders in the user profile button on the remove so the one other thing you have to do as well is whenever you’re making a start menu directory even though there’s nothing any yet we have to remove that directory somewhere in the application you don’t have to remove it once so again considering running install in one file we will add the but he think we have to do to remove the shortcut we’ll just place
it in this one component doesn’t matter where it goes as long as you remove your start menu item on uninstall so for that will simply say remove folder it is and the ID what do we do here the idea is just the idea of this item it’s not actually the idea of the thing where we move in so I’ll just say remove start menu the ID that we want to remove face to the directory so then the directory is this key here so that’s the directory we want to
remove and when we want to remove it as on uninstall so remove start menu items and like I said that can go in any component any one component it doesn’t matter but you only have to eat once and you have to somewhere so now the build succeeded we will open a folder then the Borg will install this now so no one would double-click on this we have our license we accept we install it’s gone through and it’s completed successfully so now if we go to
that was 64-bit we just installed so we go to C Drive Program Files you can see we’ve got this folder console app you can see in there we got the warm fire so now we go to uninstall we have our console app the icon hasn’t worked in fact none of the infos worked either we haven’t got the help or anything else pulled in so if something’s gone wrong there because we should have the app icon and all the details you love the help link and everything
else so let’s uninstall that or in fact also instead of one is storing from there you can actually double click your installer and you get this handy repair or remove like you do with other applications so we’ll remove it that way and then you’ll see that it’s now gone from the install so let’s just figure out why first the the icons and that haven’t appeared which they should off we should have the icons reserved the description so why do we not
have why don’t we not have that info actually should have worked let’s try these 32 bit a minute in case it’s something specific to the 32 bit and also this the installer won’t compile automatically when he thinks it’s already there so sometimes of you you right click on the installer and build and it seems to instantly say build successful then you know it hasn’t built simply change any one of the files and save it and rebuild and that’s
basically a bug in Wix and so now let’s see of this 32 bit installs and shows that info so I’ll accept will install finish and then we’ll go to the uninstall which is what we care about to the minute CF so now we still don’t have so it’s nothing specific to the 32-bit or 64-bit it’s simply that we’re not getting the icons so when I do it have it we have icon here let’s just first try and change icon to icon to and see if that fails which it
should okay succeeding even though we’ve checked well I guess it doesn’t matter just the ID just that this doesn’t get notified and fail the ICO is their source files if we change this it will fail them because you can’t find it or it should fail which it does so we know it’s definitely finding the icon here it’s just not finding the oh I know the key isn’t app it’s ARP got my boy it stands for but those unique IDs are ARP product icon an ARP
Earlham fell about I’m pretty sure so we build that once more and go to the install folder this should now give us the information so close all these extra folders again refresh this and there we go so now we have the icon we have the help link at the bottom the source link you have the product version number here which is what we set and we have our company name there so we’ve got all this info we’ve got an installer that actually works and now
we need to basically get all of their files installed without having to do that manually let’s just quickly recap what’s happened there now we’ve been through quite a lot so your product has got a unique ID the upgrade code and this will excuse me and this code will stay the same for all versions of your products so version one two three every version this should stay the same while it’s the same product and then for every install every version
change you make a new ID and because we’ve got two versions of the product 64 and 32-bit we make a new ID here each time we change there the product code the build version rather that’s where we get the IDs we then simply define basic information about the product and the package you know you build version your language your name comments all that stuff error message of the try to downgrade the media cap file now if I remove this embed cab and we
rebuild the Installer and then open the folder you’ll see what it’s talking about now you’ve got a Installer but you’ve also got a cab file that needs to go along with this in order to install so we open this you can see it’s got the file it’s got a component file test file and inside there it’s embedding the file so that’s why you put this embed cabbage yes so that when you compile it it removes you know this this basically goes inside of this
MSI so that’s what that media template does then we define an icon we use it for the add/remove programs we use the website in the add/remove programs then this spins up the UI for us that you saw this defines now what to install in the MSI and the only thing we’re installing is a link to this product components group that takes us over to the product components group which is here so don’t product I’ve changed keyboards as well so I’m a bit slow
at typing at the minute so product components is here and inside here we have our test file and then after that we define where the files get installed so install installed files and then here we define that we want this to be installed in the install folder which was defined in directories he has to be the Program Files folder or rather the our folder name inside the Program Files folder then where you find the source files in a way fan this
file is defined here and then that’s it that that installs the file so that’s where we’ve got not to and you’ve seen that so far we have to manually do a dotnet publish to generate the published output and then we would have to generate all these files each time so instead of doing that we are going to do it all automatically we undo those steps automatically in terms of the dotnet publish and then we’re also going to add all these you know well
it will be generated from doing that step as do all these so all the remaining work now or most of it because we’ll come back and add a shortcut to the file you’re gonna have to right-click on the Installer unload and then right-click again and edit and in here now this is your your project you install a project file and we want to well one thing to change is we’ve still got one open let’s change the name of this installer so it doesn’t say
console up on door install we’ll get this to say the actual the name of the product and then whether it’s 32-bit 64-bit and also the build version so the output name is here so we’ll change that first and we’ll do we’ll call it console console out – which we’d actually pull in but we’ll just type it for now in here they’ll do a variable configuration which is this debug or release so the configuration – platform and you’ll notice in the project
file we don’t have to put var dot so again yet another way of you know accessing certain things and then the build version we haven’t done yet so I’ll come back to that so for now the output name can just be you know there this basically that’s fine so we’re gonna rename that file all the rest of the stuff I think can stay the same and then here you’ll notice at the bottom also to modify the build process you can do like Target before and after
build so that’s exactly what we’re gonna do so we’ll delete the comment types around it and then we’re gonna run things before build so as you noticed what we had to do manually before was run a command line argument so let’s go ahead and run that now automatically in here so to do that we’ll do exec and then command we will do dotnet publish and then it was if we go to Arkham I think I can remember what it was anyway we load the files who went
up one folder went to console app one then it was been I can’t remember its opening back up been debug so it’ll be bin and then configuration dollar configuration and then it’s got a net core up to and then the help won’t mind that’s not there let’s cut that me we’re doing the publish oh yeah Hydra we’ll still need that but still need to get to in order to publish from because it right now this doc that published command would run inside the
installer folder we need to tell it where their project is so in that case it’s it’s the actual control app 1cs proj so we have to presume we’re in here which we are installer and then we have to do a darknet and publish but we have to go up a folder into this console app folder and then the name of this project file and that’s basically when you want to publish from a folder that you know already in if you don’t specify a path that presumes
you’re in that folder already and then from that we want to force the publish run time like we’ve already done it was win – and then either x86 or 64 so we’ll swap that with the variable platform o platform but also as well as this because we can be in debug or release we’ll pass that into the dotnet publisher as well so we’ll do – see we’re for configuration or class in configuration so this should perform then a dotnet publish before we build
each time so let’s just check that step works like I say we’ll do it in little build up steps go to the console apps and then we got the bin-debug and all these so I’ll just delete the bin folder so it doesn’t exist now let’s right-click on the Installer and build and we should see the bins appeared the debug appeared it’s actually generated win x86 for us so it’s clearly run the command and the publish and there’s all the files so it’s run the
the publish for us so we know that’s working change it to 64-bit right click and build and we should see shut on the publish command for the 64 better and we should get a win 64 folder so we know that’s working we know it’s actually running the publish command for us now so that’s one step less the one thing we do want to do though if if we want to publish this folder stays here then let’s say we change our application and we remove references
and we no longer need a reference to what we all these are standard but for whatever reason say we referenced XML and then in our application we remove that reference right now when you republish that file is still going to exist in this folder so then it will get installed so as a you know a good will of UL or the correct way of doing this will add to the before build just before we do that we’ll just delete the folder so standard Windows
command line it will do our d4 remove directory forward slash silence or q4 quiet and s4 not confirming so basically our default slash ask /q will simply delete a folder and delete everything anything that will be not the cs proj so that will now be console being then configuration then it was dotnet core app 2.0 and then the name of the configuration folder which is win – platform and that should delete the folder before it publishes so we’d
other than we need welcome amount as well check that room pretty sure all that will work so we have the folder here R in 64-bit so when we right-click to build should delete the 64-bit folder first which I think the thing is we haven’t seen it works it’s worked fast and done so I’ll tell you what let’s make a folder in here called my folder and then we run the command again this should have removed my folder which it hasn’t okay so maybe that
isn’t running that should be running okay let’s just unload let me take a quick look I’ve done that correctly so before build remove directory go one console up form out we’ve got two console up ones so good job we did check reload yes so we have the win 64 right click and build and that folder should disappear or it’s disappeared and appeared well it still not worked it’s funny how it’s not failing as well though okay let’s unload once more what
else are a missed remove directory silent queue in fact what we can do for quickness is copy that what it’s running from where it will be executed from anyway Oh in fact that was right its console up one I don’t we’re already in this front years fine so we would be in this install or anyone’s a command so let’s run this actual command so we’ll paste that in we’ll simply change this for what we know which is configuration would be debug and dotnet
core up to a win and then X x64 and before we’ve gone in so let’s just go to the folder to see the system cannot find the path specified so we’ve what have we messed up there we’re in there we go up one console app one obviously something obvious I’m missing here bin-debug bin-debug Oh net caught up not in dotnet core up until it’s getting late a net for up so now finally this should work so we should see can the most basic steps taking a while
here we now build this we should see that folder disappeared there we go so it’s now we’re going to delete that folder first and then publish so it can be guaranteed that you know that publish command is nice and clean so I’m happy with that let’s unload again edit the file and let’s put a few notes in before it gets too large so before build clean previous build folder publish dotnet for app and then what else do we need to do and we will want
to I don’t know what we want to do the build version so I mentioned near the start that we want to pull in this assembly version from this console app and not from the build version we temporarily put in there variable so in order to do that we will need to get assembly version now and whips to get the assembly version there’s a get assembly identifier locally it’s a built-in thing that will read dll’s have you well so these compiled the URLs so
to do that we’ll now need to specify we’ll need to know where this file goes this DL up so when we open the folder and it gets published we end up with a published one and in here ends up four hours being this console app one DLL so this is the one where if we do properties on details we got the version 1.0 0.0 if we change the console app to one point two point oh and we just reload in fact I won’t quite work yet if we just build that one and I
sort of manually want to publish for now then if we go back to the same file you’ll see it’s one point two point oh so this is the file we want to extract me info from so in that case it’s basically the exact same thing as the folder we deleted it’s right the way into the publish folder which is here and then inside that publish folder ours is called contour a4 not dr so you’ll specify whichever file and the publish folder you want to extract the
the main assembly version from and this is our main project file so that’s the one we’re picking so the get assembly ident or yeah assembly identity or pulling multiple bits of information about the assembly so that’s the get assembly identity and then we close it with a greater than tag tip to create an inner tag and inside that now we need to specify what we actually want from that so the output of that the task per call your task parameter
assemblies and the item name that we want to get from all this is assembly version so all this a little bit here basically extracts an assembly version from the file and then we can make use of that in a minute so in order to now make use of that we’ll need to define a constant which is basically a variable so the same way we did the question mark define product code blah blah blah it’s the same thing just different syntax yet again because we’re
in a different file format so to do that you do define constants I think are we in the right place for that though before targets I think we need to put this lot in a group first so it’s a property group and put that inside because we need to do this in one big group so I think that’s known in the right place as well as invalid child and get element no it’s not a property group them oh no we don’t put that inside a property group we need to put
what I’m about to do next inside a Property Group so we’ll make a property group here and now we can define constants there we go let’s define constant says like say defining variables so the one we want is build version the build version will equal and now again like I keep saying I know Wix is awful for the amount of different ways to define everything but it’s what we’ve got to use today use a percentage mark instead of a exclamation and
instead of a dollar we it’s now turned into a percentage mark and that will now allow us to get this piece of information here this assembly info so together now we do assembly version which is this item name dot version and all you need to know about that is that we’ll find this file get the file assembly info which has come from the properties assembly version and we simply pulled this piece of information in so you could basically copy and
paste this change this to the correct path and you know that now you’ve got a variable build version with the correct build version so if we reload the project we can now in product this temporary one we made here which is one two three four we can delete and because we’ve really found that exact same variable in the works project so we build that and then install it I hope got in the object folder a bin folder it’s now if we install this one you
can see for one it’s picked up our new name debug x64 that’s the manga rent I don’t think we show the version number anywhere just yet or the build version rather and then we go to uninstall we should at least see in here to show that it’s the right one you can see there version one point two point oh and down here so we now know we’re pulling in the version number of the actual our project so also we have to do one run through a change aversion
number let’s change it in the actual project and then rebuild the Installer and the code will have changed so that’s that we might want to add well no we can do that in the name so it’s unload the project again go back into editing here so we now have the assembly version the build version what else do we want to specify so now I think the next thing we want to do is as I mentioned we want to extract all of this publish folders files all of these
f’n that appears in a specific folder we want to automatically generate the components from it like we did for the first one where we generated the single file so we don’t have to type it 200 times so to do that you can use something called heat in Wix and it’s basically a harvester that’s what they define us and it will look in a folder like this folder it will find all these files and it will Auto generate a component for each one and that’s
what they call classiness you know the harvesting the components from a folder and it saves us having to do all the manual work of defining every single file in that folder so what we’ll need is let me think where do we put the heat thing I think it just goes here I think it’s in the before build yeah I think we just plonk it right here heat directory um don’t give us any intellisense what do we have to add a reference yeah I’m a target as I’m
valid target before build yeah I know we have this heat in here I’m pretty sure we do I think we need a reference I think we’re missing a reference let’s just remove that many we load the project I’m just have a quick glance of references I’d reference wick tool sir then see where everything stands out in here maybe the utils I don’t know think it’s and the utils but nothing else looks like it’s got anything in let’s try that so right-click on
the references add reference browse to the same folder again double-click on the wick utils and ok and then let’s unload this edit it again and let’s see of the the heat thing appears no it doesn’t maybe just in tally sense doesn’t work yeah okay let’s just try and tie because I’m sure this is where it goes so I think this is just going to complain BOTS like say let’s just ignore that so the heat directory would basically say harvest file
components from publish folder and we need to first tell it the output file to create which is obviously it’s going to generate a components you know a bunch of components a wicks file so it’s going to generate a W excess file so we’re going to give it the name so we’ve got one already called components so let’s just call this components generated or something dot w XS we have the directory where these files will be installed so directory ref ID
and that will be that install folder ID just like we have in the component we installed that’ll go into the Program Files folder the other components group name which is basically just the component root ref thing that we had in the product installs who call it anything so I’ll just call this published components say then suppress comm will say true just so it doesn’t you know do anything with comm files which we’re not doing in this install now
the important ones are directory and that’s where it’s going to look for all of these files so we’ve already got that here same place again so that’s what it’s going to look for all files and effectively harvesting from those you know that path it’s going to pull in all the files and generate from this will do suppress fragments so we don’t want the Auto generated file to have a bunch of fragments so we don’t need that will do suppress registry
so we don’t want to add key paths for every file as a registry entry something that Wix does oh I’m bother going into detail on that simply set that to true suppress route directory again we don’t want that we want to basically suppress oh let’s keep it a nice clean simple file so it’s going to auto generate a really clean and small file you’ll see after when it’s generated Auto generate the goo it’s you’d think it’s set to true collection assets
are false you don’t want to auto generate them there you want to generate them now basically is the trick so again if you want to know more about all these little pieces of info you can simply google the Wix documentation to see but this is all you’ll need you can you’ll be able to take all this heat directory and just simply change this one path you know make it usable for your product so I don’t want to waste your time get into all the depth of
all these bits you know bits of installer details you can do it without you know it’s this I don’t usually say it in code but certain things like this you just don’t need to know about you only need to know about it when you need to use it so you can have you follow these defaults and it will work and until you have an installer where yeah it may be using calm or maybe you want to do something different then you know you learn it then but if you
tried to learn you know like exactly why this little part here extracts the variable file version from that folder or from that file with you know I’m telling you it does that but if you really wanted to go into the depth of why touch parameters this and items name this you’re gonna waste days and not months just learning kind of a pointless thing in my eyes this is you know enough to get Wix to do what you need it to do and then you know you
know why things are happening you know that this directory is where it’s looking and you know it’s gonna generate all the components from it you know what the components do you know that specifying them and the feature installs them and so so like Sam I’m going into enough detail in the Installer that you understand the bits you need to understand but then things that are just going to waste your time like these suppressed features all the
wasting time up so generate Goods now is true and basically these two together generate you the I’ll see we’re going to open the file manually is the one we wrote so this is the component we install now the first one so this Auto generate false and generate now adds a GUI to each component of all that setting does the directory is where we scan for them the directory ref install folder is this ref here so it adds this to the files the file source
for all of them is obviously naturally this so they get found that way anyway the component generated wxs is like to the file name the component group name published components is the component group here that we’ve made called product components in this case so it’ll make a group like this with IDs like this that reference every file so just auto generating the file we just manually generated the toolpath again one you don’t need to know about
just put dollar wicks toolpath I just basically helps it find the harvesting tool and that’s an inbuilt variable so it just simply makes this work and then we will need to pass in because we are using or are we using in fact we aren’t using so no we don’t need to do I don’t think I think that’s all we’ll need for the moment let’s just see if this works so if we just write like a reload right I can build what we should see is in the install folder
the heat on the heat director toughs not be initialized whether its input parameters suppress registry parameters not supported by heat directory okay so the suppressed oh I’ve tapped that wrong maybe that’s why it failed unload edit this new keyboard keeps making me type wrong so suppress I have a go suppress registry reload that and build again and then in this folder if it works we should see a new file called components generated there we go
so this is what’s just been created by the heat task the heat directory and if we open that off you’ll see it’s generated a file with a directory we have installed folder a component with just a random ID and you do it you know a unique do it a file ID key path is yes and the source ask the source dir which is pulled in from the in fact that might be wrong let’s see so this is generated effectively a bunch of components just like this but now
we’ve run it once we built once in the Installer we right-click add existing item we can add that auto-generated file now so it’s in our project and it’ll change every time we build but that doesn’t actually matter because something’s gone slightly wonky as well it’s generated we’ve gone one folder too high here so this is the folder above and then this is the folder below so let me just right click unload and edit we are one folder above for not
in the publish folder so the heat directory is now collapsed when platform backwash publish I want to go into the subfolder publish reload so I’ve changed the directory of the heat directory build again and this time have we open this file we should see this change and these remove because that’s the top level one and there we go reload yes this is now generated all the files that were in the the publish folder and it generated them under a
component group called published components so now in order to install all of our components those we just have to do is install this published components as well so we go back to product and we’re installing here component group product components we want to also install published components so we’ll change that to published and if we right click and build we should hopefully end up with an installer yeah loads of problems platform attribute is
invalid according to the datatype that’s the one we ignore on the system do not find source app oh so I think we need to pass it sauce the IR then there’s one other thing we need to do unload edit go to so there’s the heat directory I think because the way that heat runs its unaware of any variables because we have a drill this back down because in here we’re using configuration and platform I don’t think it’s finding that variable it’s you know
needs to be told if those variables so we will do let’s try in the define constants because this will happen right away put a semicolon after the build version and let’s specify a base path and then that base path we wants it to be the publish folder once it be this folder so now we just define a variable that’s going to the published folder another thing we’re installing let’s now tell this task to pass it in as a variable which i think is
preprocessor variable and we’ll pass it in as var dot base path which again is about the 60th different way of accessing a variable and let’s see how that works and I think that is gonna then tell the Heat directory where you know weather variables are so let’s run this and see if it works if not I’ve got one other idea it might need the linker base input paths as well looks like it’s working hopefully it’s taking a while all not quite the target
file is installed by two different components test file oh so it did work but we’ve left our test file in components so let us just remove test file for the minute or comment that out and comment that out so that’s now emptied man Mon there now we’ve got an empty component but let’s see so that’s kind of obvious it realized that we were trying to install the same file twice so this one builds we should have very close now to a finished installer
we’ll do it a few more tidy up steps at the end but we shouldn’t be far off allowed the shortcut and we will rename this file to include the build version but other than that we should be pretty much done so long as that’s built there we go 26 max I think it’s working still hasn’t said finished yet though build complete directory installed programs is in the oh yes we’re now back to the same thing we need to remove the install start menu icon so
tile let’s add the shortcuts just do this all in one go now so I’m pretty confident that’s now working because it’s it’s built the thing it’s 26 magnet just failed because we commented out let’s remove folder as well so the one other thing we want to do when we’ve installed this is in our application we have when we go to the publish folder we’ve got this exe that we want to run that’s our program if you up so that’s add a shortcut to this file
so to do that let’s let’s uncomment those read comment that because that’s gonna now be fixing the short Crofts the Start menu folder that we need to remove this will be shortcut to main application we’ll call it well uncomment the test file this will be show up cut and we’ll just say main a short cut copy paste the name there then we’ll cut file main app shortcut and in fact we don’t have a filed it with Rona shortcut so you get rid of the
shortcut Oh get rid of the file rather add instead a shortcut the ID will be a shortcut main app shortcut so all we’re doing is prepending the word shortcut to it because the components got that ID or actually I don’t think it matters then you can give it the same ID because it’s a different type so give the same name as the components I think that’s fine the name and that’s the physical name that appears in the you know this name here it’s
that name we’ll call console app for this instance you could reference your you know your localized thing of you wanted it could reference this one so instead of doing the name like light you could do a dollar localize college named bar up the platform and then it will give it that mean now at the target so you know where is this act what’s the shortcut pointing to will be now in the install folder so you have to put this in angle brackets when
you’re specifying a target that’s the folder and then it’s called console app 1 dot exe that will reference the Program Files folder and then look for that see that’s the target data show good at the directory is in the directory that the shortcut will start up in we want to tell it to start in the folder that this files in so we should be able to start in directories we want to be in the installed folders well think so it thinks it’s in the same
folder but I think we might need to pass in an ID in the directory though but that is the idea isn’t it so yeah I think the directory is going to be install folder as well and the owner saw the the directory isn’t the directory is physically where you’re placing the shortcut which is of the Start menu this thing here so you wanted to go into the Start menu subfolder and then the it’s the working directory I’m on about where it thinks that you
know the application thinks it’s been executed from that is when you want the install folder from the final one let’s give it an icon as well and will reference the icon de ikou which is in product will reference the same icon here through the ID so that should add a shortcut to where the name of the same product which will appear in the Start menu inside the subfolder that we give a name and it should point to the exe that gets installed I
should think it’s being run from the folder where it’s installed which is the Program Files folder and it should have the icon so that should now allow us to build fully and successfully it should install all files and we should also have a Start menu shortcut now so this should be effectively the complete installer and then we can simply rename and move this package this MSI to a nicer place so we can simply run this and have the whole thing
dawn madyun and a folder called installs and then you can add that to your continuous integration if you like to you know have it so that you simply build and you always get an installer for every code change or commit but we won’t go into that tooling as videos getting pretty long already so still building I’m I’m very confident this will actually finish and build correctly this time or not keep up main shortcut is directory install folder to
keep up a component main app shortcut why do we have oh I know why because as I mentioned every component needs a key path you know a key feature usually the file is the key in this case a short core can’t be the key so a trick to make a shortcut when it there’s no file inside the component you’re simply making a shortcut we’ll just make a registry entry and just use it as a key I mean it’s not really doing anything it’s simply serving as an ID
to the Installer so reg shortcut key I’ll say and again this is something that you don’t really need to know to get your program working you simply type this in and and that’s why you every components gotta have a key component a key thing inside of it and a shortcut can’t be one of them because it’s not unique because it’s simply it’s trying to figure out a uniqueness by just using like a working directory for example so I’ll just make a
registry key entry point in the current user software and then we’ll put it in that our install folder name so the nice this one here product folder name so it gets this name in the registry and it’s not doing anything we’re simply placing it in there we’ll call the name shortcut value just Mario can be one the type will be integer so you’ll see in the registry then simply a you know a value of one and then we can now specify key path this yes
and now we can now act as our our unique B or this component shortcut and that should solve that issue of it complaining that this component isn’t unique it can’t be made unique by just a shortcut and here we go undefined process available of our product name folder oh it’s not var its lock because it’s in the localization file and then we’ll take a look at the registry as I’ll get ready and take a look at that so we’ll see once we install of
where it goes so we’ll go into the current user software and then in here we should see console app or something so we’ll minimize that until it’s built on me installed and then you’ll see that it should appear but like say that’s doing nothing so there we go a successful build 26 Meg so let’s go ahead and install this so pops up yep install accept fly through finishes good that’s a one let’s check the Program Files folder so you have console app
and now in there you can see we have all of our files we can hopefully run this exe and the application runs we should have a start menu thing now though your folder called console up in there we have a shortcut that says console up 64-bit they should run that exe when we click it which it does and even get the icon there and then finally in the registry we see nothing here we refresh and we should see console app and you see shortcut there now
and all the way over there so but a really long thing it’s value of one so this is simply acting as a unique ID for the shortcut and then in the uninstall we should see the uninstall for it and we can remove it so that in essence is the complete Wix installer you can see then it’s fully remove that the Start menu should have gone as well which it has so really that’s like a full full Don installer what you’ll need to change for your project is
one you’d open this comment you change all these values to suit yours to the components you’d simply have to alter this path to point to the right path and this release you’re probably putting a variable so we can reuse it but there’s this path which points to the published folder obviously change all the gue EADS so change the speed here change this name here to point to your main applications exe that’s all fine for that component generated
as auto-generated so that you don’t need to change anything about that directories you don’t need to change anything about that so you’ve only got a can’t change common and components so far then in product you need to change these three keys you’ll need to change this icon of be not using this icon to point to wherever you want change your website update your images and license files the physical file is not there you don’t need to change any
text he just need to change the actual files change the title here and then you’d unload your project edit the project you change your output name to whatever you want which we’re going to rename in a minute as well you’d go down to then basically this before build you change again the obvious the path here the path here the path here and the bass path here and the base path here and that’s it that’s all you change for your specific project and
that’s the same when you now make another project in future they’re basically all you have to change just a bunch of a couple of paths Surrealism so the last thing we’re gonna do just to make this a bit tidier once we’ve generated an install we don’t want it really been ins out of a bin de Bourg you know folder we want it to be you know really just installs a folder here so it’s nice and clean so one thing you’ll notice actually is you’ve got a
bindi ball and then this en-us a culture because that’s going to end up being multi culture for now we’re on the build to not bother point it inside a culture specific folder we’ll remove that so in order to remove that just go to the very top property group here and below the output tie let’s pop I think it’s called just for thought it was sure it’s just cultures and a semicolon to signify no cultures and now when we build that should basically
build in a fault like directly in here now so you shouldn’t do it Ian us it should just build Ratan in this folder and that will just remove that a variable that would change when we change cultures otherwise when we’re trying to find the file to rename it it’s gonna go to you know a different file every time which is not what we want so when this finishes I’m hoping we get the file here there we go so it’s starting to appear here so about
specifying cultures with the semicolon we’re simply stating that we’ve got a bunch of no culture so now you won’t get that folder it’ll just be a bin debug or effectively bin and then configuration and then the name of the file so we can now can figure out the exact name of the file and we’re going to use that so that we can rename the file and include the build version so down in here now we’ll go into that after build instead at the before so
once it’s generated it will copy this get assembly code exactly which is just that bit there because we need to get the assembly version again so we can give it a you know the build name that’s what we want to include the build version so I’ll get the assembly version and the after build and then we want to rename and move final MSI so we’ll do in exact command and again this is just thing command line commands we want to first create a folder so
by default the commands run in this location as we said the place where the Wix project is I want my MSI is to go in a folder just called installs but because it doesn’t exist here same as we type CMD you want to do basically mkdir off and make directory installs and that will make an installs folder this one other thing we have to do is if you run that again it will fail effectively because it exists so we have to do if not exist installs make
dir installs and then it won’t fail it exists and if it doesn’t exist it will create it so we want to do this basically and all that’s doing is ensuring that the folder exists but using command line to do it and now we want to actually then move the file so command do move which is come on line thing and we want to in this case we’re in this folder remember the Installer it’s in bin-debug and then it’s right there we in fact we’re not even in the
configuration we’ll just didn’t bin oh here we are debug is the configuration to rim bin and then configuration and then the name so bin dollar con figuration and then backslash and then dollar and the output name which we have because it’s defined here so we got the output name we want to move that into the installs folder and the name of it wants to be we’ll call this console ah – and then this time we’ll use the percentage for the assembly
name which we made use of someone I here so we’ll do that which is you know the build version will include the build version now in the name and then – the configuration – platform and it just means now that the file and then dot MSI so I’ll now rename it and that should be the last step so as we load and build and you should see this time it’ll build in here we know it will up here we should get installs folder and when it’s done he should move
the finished install MSI into this folder and now it’s got a fully useful name it’s gonna include the HD book or release if it’s 32-bit or 64-bit and also the build version of that of your product so there’s no confusion install build exited with code one contour we’ve got put MSI at the end of the first name unload edit obviously we’ve got the build name the output name but I just think through the MSI so put dot MSI because you know that’s the
output name we load yes build yes are basically what this will do is generate the MSI installer believe it’s really obvious of everything about it whether it’s been you know a debug or a release 32 or 64-bit in one version it is because it’s easy to get confused or making installer and forget that you end debug or think you in 64 bit or 32 and at least if the file name gives you that information um you know you’re less likely to make those
mistakes so this shouldn’t take another second and it should be done and then we’ll just build the other one as well say go now you can see we’ve got the console app it’s version 1.2 point 0.0 its debug is 64-bit when we run it it also tells us that you know it’s the 64-bit and then let’s say change our project or change this to 1.3 to show that changes or change it to a release and 32-bit and then we’ll build again and this should generate this
new package now is a release 1.30 so that’s all there is to Wix I know it’s a hell of a lot to take in in one video there’s a lot of concepts but it’s kind of just how which works you’ll find that you’ll now take this as almost a template and tweak just what you need to tweak to get it to work for you and the key really is simply the harvest directory where it picks a directory to install all the files and then tweaking all your settings you know
your company name your descriptions your details making there are shortcuts that you need and so on so you might after watch the video a few times you might have to do a bit of research but what I’d say is basically take the you know this installer as your base user in your project tweak simply there the folder names and things to get it to build and work and that’s that simile all you need to then build an installer I wouldn’t worry too much
about not understanding all that the inner workings as long as you understand enough to to we this to work for you and I wouldn’t recommend wicks of there was something nicer you know it certainly prefer a nice a way to make installers but this is this is the only real installer I know and the only real installer you ever find when you look for decent Windows installers it’s definitely very outdated but it works and it does what we need so you
know hopefully this is this is what people have been after you want to make an installer I’m sorry it’s not easier but it is what it is and hopefully I’ve explained it well enough that people will understand again as always leave any comments if you don’t understand or get issues now I’ll help you out but hopefully this has been useful