Ship Your Product! Let's Build An Installer In Visual Studio
December 2, 2024
• 6,489 views
installerinstallersvisual studiowindows 11wpf applicationwpfwindows presentation foundationmsimsi installerwindows installermsi installer tutorialmsi packagesoftware installervisual studio installerwindows 10visual studio tutorialdeveloperdesktopdesktop developerdesktop developmentdesktop softwaredownloadable softwarehow to ship softwareC#csharpdotnetwinformswindows formswinformwinforms tutorialwpf tutorial
This might not be as glamorous as building a fancy new web application...
But if you're still shipping downloadable software, odds are you've probably found yourself needing an installer!
Don't worry -- it's a super easy process and I'll guide you through it from within Visual Studio!
View Transcript
okay so I realize for many of you this will seem like it's a legacy archaic type of Technology but in this video we're going to look at building installers for our Visual Studio Projects and yes that's just a friendly reminder that not every single thing that's built is a web application there are still tons of people building desktop applications as well hi I'm Nick centino and I'm a principal software engineering manager at Microsoft we're going to go through a simple tutorial here for getting set up to make an installer I'll show you the very Basics but you're going to have to think about how you want to configure them for your own product install if that sounds interesting just a reminder to subscribe to the channel and check out that pin comment for my courses on dome train with that said we're going to jump
over to the Microsoft website to see where we can go download the project templates for this stuff okay so I am on the Microsoft learn challenge website here where we have the download links uh I am going to put a link to this in the description so you can follow along but you can see that there is some information you can follow along with here this is not my content this is straight from Microsoft so if you want to read through this and have a different perspective you can absolutely follow along with that what we're going to do though is go click this link where it says Visual Studio installer projects again I will also have a link to this one and that way if they change this page or something like that and the link is gone then you'll still have access to it
if we click over I guess I already had it open in a tab here you can see that there's a download button so I would start by pressing that so if you're watching this and trying to follow along press this get the download going so you have it that way is you're Contin to watch this you have to pause it less so I want to call out though that they have a couple of things down here that are worth noting so it says the extension is designed to work with Visual Studio 2022 so if you are watching this in the future and it's Visual Studio 2030 or we're in the year 3000 or something like that uh this might not be the thing that you want to download and they're also saying you can download a version of this extension compatible with the older Visual
Studio versions here uh I believe if you go get that download instead you'll be fine to follow follow along with this tutorial still we're going to be going over the basics of this stuff maybe there are some nuanced little differences here and there but the general idea should still apply so make sure you get this downloaded you're going to want to make sure that visual Studios closed down as you're installing it it will prompt you for that so visual studio off run the installer it will get the project templates and the things that you need installed and then you can restart Visual Studio once you have all that done let's continue on okay so jumping over to visual studio we'll go ahead and make a new project just so we can see it all come together you can see that right away I have setup
project up at the top here I'm actually going to start by making something different we're going to make a WPF application and that's going to be the first project in our solution and then I'm going to add in the setup project after if you already have a solution and you want to add a setup project you can go ahead and open that one instead if you're just following along and you'll be able to go ahead and configure your setup project the same way that I'm going to do for a brand new application so I'm just calling it out that I'm not opening an existing one I'm going to just go ahead and make this here maybe uh I'll go ahead and put this in my repository actually I'll make sure that I have this committed to my repository we're going to call it uh installer
tutorial uh that's going to be the solution name and then I'm going to have a WPF app is going to be the project name so you'll notice my project name is not matching the solution name and that's because I just want to make sure that the app itself is called out separately from the solution and then we'll add the installer project in after so go ahead and press next on that NET Framework uh I guess I can go ahead and pick nine because that's out now go ahead and press the create button before we continue on this is just a quick reminder that I do have courses available on dome train if you're just getting started in your programming journey and you want to learn C you can head over to doome train I have a getting started in C course it's approximately 5 hours
of content taking you from abs absolutely no experience to being able to program in C and after that I have my deep dive course which will take you to the next level with another 6 hours of content so that you can start building basic applications head over to D prain and check it out let's head back to the video again this first step that we get here is just to have our application right so if I go ahead and run this we just get a really simple application if you already have one built and you're ready to go that's awesome news but you can see boom we have a little Pro program running great news but from there we're going to go ahead and rightclick on our solution Explorer we're going to add and go to new project so we'll go ahead and do that
then we're going to pick setup project and press next so then I'm going to have um we'll call it installer tutorial and we'll call it installer so we'll have that in here as well and boom we get this thing popping up and we're like okay well what now right do we just have this installer it's all done not there's a few things that you're going to want to make sure that you have set up so if I were to just go ahead and build this I just want to show you the default because I think that for my learning experiences at least if you're like me you want to try things out the base case is interesting to go explore so I just built it it succeeded if I go open the folder and we check out I'm in debug you can see that it
made an installer right so if I go to run setup right so we get this little uh wizard you can see that by default installer tutorial. installer is the name of it you see that popping up everywhere kind of ugly you probably want to change the text for that so we'll look at doing that we can press next you'll see where it's going to install you see default company name uh back SL installer tutorial it's going to go into program files by default we'll go ahead press next and then we can go ahead and start the installation so if I were to go do this it's going to go install I don't necessarily want to so I'll cancel that yes I want to to cancel and we get it stopped so that's the default base case but there's a couple things we want to consider
so the first thing we're going to want to think about in my opinion is going to be the dependencies because if you're installing this on someone else's computer what are they going to need well The NET Framework I picked net 9 when I was getting my app set up so first of all I want to go to rightclick on the project and go to properties this is going to pop this window up I want to go to prerequisites and then you'll see in this big list of all of the net runtimes I'm going to go ahead and pick net runtime x64 you can pick what you want to do here so specify the install location so download prerequisits from the component vendor's website from the same location as my application or from some other location just going to leave the default and press okay right
so now that's there something you should also check is because your installer you're probably releasing in release mode is so I want to save the changes yes but if I go to release now and check this out just a double check right it's not checked here so make sure that you're doing it here as well because you might have a little bit of a crappy surprise if you have it all set up in debug and then you switch to actually release your installer in release mode and it's not the same so we'll get that set up there and press apply so just to double check in release mode if I go to PR Rex boom we see net 9 checked off if I go back to the active debu bug because that's what we're going to be using for the whole tutorial here you can
see that it's still checked off there so we are good to go you can pick different options here so I'm going to have the files in the setup file itself compression you can pick if you want to optimize for size or speed so if size is important for you where you're hosting this feel free to go reduce that but at this point this screen is probably pretty good now you might be wondering well what is actually going to get installed right now and the answer is well nothing so we want to go right click on the application folder here and go to add and then we're going to get a project output so in here I'm going to go pick from uh the project dropdown it's already selected installer tutorial WPF app if you're doing this on your own project right so you had something
that was already created you can go ahead and pick something else whatever your project is but you probably want to select the entry point to your application right so if you have a bunch of different dlls and project files and stuff like that that get copied into your application's bin directory when it's built pick the entry point because that stuff will show up there I'm going to be picking publish items but you may want to look through this and see if there's a different option that makes more sense for you right for me I think that for the most part publish items is almost always going to make sense so configuration will also go to active and then now if we look on the right hand side we can see that if we go into application folder we have that publish items thing you can
set up um to create a shortcut here as well if you want so you can go ahead and do that so rightclick create shortcut and the same thing in the program menu you can go ahead and add a shortcut as well but otherwise this is mostly what we need if I were to go build this now what I'm going to do is go ahead and run this and I'm actually going to install it we'll see where it goes and we should see that we should be able to get something launched so next uh I'm actually going to copy and paste this whole path so I can get there pretty easy we'll go install it okay so it's been successfully installed I'm going to go ahead and jump over to here and you can see amazingly we have our WPF application installed now what you should
notice is that I have a pdb file in here probably not what you want to have but remember I built this in debug right so my current settings were for debug that's probably why there's a pdb there but these these are the types of things you're going to want to check when you configure all this stuff so please as you're going through this on your own spot check this stuff don't just blindly try and follow along with this YouTube video and say well Nick said this these are the default options it's good please don't do that double check what you got going on if I go run this now though boom we get main window very exciting I know but again double check what's being output here especially if your application is more complex than just an empty w PF app you're going to want
to make sure if you have different configuration files or whatever other defaults those get dropped in okay so double check that but now if we want to continue on with iterating with this and spoiler alert we do we're going to have to uninstall it okay so if you go to your programs and features you should be able to go to see um where this was installed so if I search for installer and I get installer tutorial. installer right away I can go ahead and uninstall that so we'll go watch that and you can see that folder got deleted right before our eyes right so I can't even get back to the company name uh that folder is just completely gone so I'm going to go ahead and close that but before I do I just wanted to mention that the next iteration I want to
look at I want to pretty up these things here so I don't want default company name there's no way I'm shipping software like that an installer tutorial. installer is a little bit weird so maybe we can do something better there so let's go ahead and close that and go back to visual studio if we want to start making the installer path and installer look a little bit prettier and not have those funny strings everywhere I'm going to go ahead and right click on installer tutorial. installer go to properties and actually it's not that I need the properties window so if I pull this up on the right uh so in visual studio if you always keep your properties windows open you will already have this I generally keep it collapsed because of what I'm doing I don't really need it it's a little confusing if
I go have this open now this prop properties panel and press on installer you'll notice that this all changed right that's different than me going to right click and going to properties when I do that I get this popup so just a reminder you want the properties window it makes it kind of tricky to find but this is where we're going to have a lot of things to configure you can see that the manufacturer that's something that we saw so we have author manufacturer so I could say uh Dev leader up here I could go ahead and say that the manufacturer is also Dev leader LLC or something like that we could put a description this is the coolest let's see what else we have install for all users so you can make this uh change by default I want that on let's say what
else do we have product name here so uh coolest app we're going to call it and what else you can add like support stuff here so maybe I would say my website here and a phone number I'm not going to put in and title I'm going to probably want to put coolest app installer and you can have a version as well right so there's a bunch of different settings that you can consider manufacturer so maybe I'll change up the URL here I'm going to put support here and then the manufacturer URL I would do like that okay but these are things that you're going to want to tweak and tune for whatever you need uh I'm not here to tell you you know the right way but I just want to show you that this is where you can modify stuff so if I go
ahead and build that now we'll get that um I want to call out before I go ahead and install this one that the executable that we have put into the output directory may still not look like how you want and that's going to be because the way we set this up is that it's taking the contents of the publish output and just dropping them in but that means if you don't want your applications executable to be called installer tutorial. WPF app.exe you're going to want to change this project instead okay so we would go up to the properties here so if I right click go to properties this is where you would want to change it you could go ahead and make the assembly name uh not be the project name right so I could call it coolest app here right so one word coolest
app if I go ahead and do that now instead of saying installer tutorial. WPF app the executable that goes into the bin directory will be named as such so let's go ahead we're going to rebuild this now if we go back back to the file explorer and we have the setup files here I'm going to go ahead and run this okay so this is already looking way better it's super cool right coolest app if you will so welcome to the coolest app Setup Wizard this installer will guide you through uh required steps to install coolest app on your computer heck yeah now if we notice the folder it says Dev leader LLC right so the manufacturer name and then coolest app so again this is working just like how we want I did have by default it's going to be installed for everyone that was
if I go back over to visual studio you see install all users is set to true so that's the new default so we'll go ahead and press next I'm going to go ahead and install this once more very fast this time if I look on my computer and I have this pulled up here I can go to program files Dev leader LLC coolest app and you'll notice because I went and changed the WPF apps output file to be coolest app again no space right so I wanted to show you with a space is where it's installed the folder but no space for the assembly name just so you can see where the settings are actually configured but again we can go run this and it should work we were able to successfully add a WPF app you could have started with one that you already
have we used the publish output directory in our installer and then we were able to go configure the installer properties to have a better manufacturer name things like your actual output that you want named properly so your folder path looks right and then your actual assembly looks right as well one final thing we should double check is if we go over to this MSI if we were to go to properties we should be able to see that if we go through the details here some of the other things that we configured WR the title so coolest app installer this is something else that we configured and then in the comments I said this is the coolest that actually came from the description all the way on the right here you see in Visual Studio these are how you configure some of these things yes people
are still building desktop applications and if you were looking for building an installer for your app I hope that you found this helpful thanks and I'll see you next time
Frequently Asked Questions
What version of Visual Studio do I need to use for this tutorial?
You'll need to use Visual Studio 2022 for this tutorial. If you're watching this in the future and it's a newer version, like Visual Studio 2030 or beyond, the extension might not be compatible. However, there are versions available for older Visual Studio versions as well.
How do I ensure that my installer includes the necessary dependencies?
To include the necessary dependencies in your installer, right-click on your setup project, go to properties, and then select prerequisites. From there, you can choose the .NET runtime or any other dependencies your application needs to run.
Can I customize the installer properties like the manufacturer name and application title?
These FAQs were generated by AI from the video transcript.Yes, you can customize the installer properties. Just right-click on your installer project, go to properties, and you can change the manufacturer name, application title, and other details to better reflect your product.
