C# Desktop App Deployment with Squirrel - Easier than MSI Files, Better than ClickOnce
Vložit
- čas přidán 9. 07. 2024
- Full courses: www.iamtimcorey.com/courses
Source code: leadmagnets.app/?Resource=Squ...
Patreon: / iamtimcorey
Newsletter signup: signup.iamtimcorey.com/
Deploying your desktop software isn't the easiest thing to do well. Either you go the simple route and just copy your files to another machine or you try to create a complex installer file that is hard to understand and support. Fortunately, there is a third option. In this video, we are going to look at Squirrel, a simple to use installer that just works. We are going to see how easy it is to create an installer that also keeps our software up to date without being a huge headache.
0:00 - Intro
1:12 - What we are going to do in this video
3:40 - What is Squirrel
7:02 - Squirrel GitHub page
8:43 - Squirrel NuGet reference
9:30 - Automatic application updates update check
15:55 - Assembly version changes
17:47 - Creating custom NuGet Package
27:04 - Installing the application
29:05 - Running the installed app and fixing bugs
33:49 - Updating the application code
37:06 - Releasing the updates
43:06 - Recap
45:20 - Summary and concluding remarks
Thanks Ralfs for the timestamp breakdown!
This tutorial came in clutch. Was just about to wrap up a current winform project and was wondering how to make the installer for it. Now I know, thanks Tim.
Awesome!
Thank you Tim for such a detailed tutorial. I really appreciate the time and effort you put into your videos. It's the small details you explain which matter the most to me, for example when you explained why the @ is used before a path string.
I appreciate that!
It's nice and uncommon that You take care of the recordings that you posted some time ago. Thank you for the time and energy You put into promoting knowledge.
You're very welcome.
Thank you and congratulations on 40k subscribers. It feels awesome when I say I'm one of your first subscribers. :)
Thanks!
Great tutorial! Feel guilty that I can only leave 1 thumbs up for all the work you put into this. Thank you
You are most welcome. Thanks for watching.
Learned some thing very useful.This thing is good man. Plus dapper video was also helpful.
I am glad you learned something new.
Great, easy to understand and clear video about squirrel. Awesome!
Thank you!
This video is...AWESOME!!! The way you explain everything step by step is incredible. I have a lot of question, actually..a lot of requirements but I'm pretty sure I will find answers on your videos!!! Thank you so much!!!
You are most welcome. Thanks for watching.
Your videos are my favorite, you're an amazing tutor.
I appreciate the kind words.
Many thanks, Corey! As always, you are such a big help!
You are welcome.
Magnificent explanation. I didn't know about squirrel but i will have it in account in the future.
Great!
Great video. Thanks for the heads up on such an application (Squirrel that is) existing. It appears it will solve the install issue I have for a widely used corporate application.
Excellent!
Hello Tim again,
I just wanted to thank you very much for your videos... I asked you on the video of SQLite demo video about a problem I get in deployment, but now with Squirrel, it is solved... So, Thank YOU A LOOOOOT! GREAT WORK SIR!!!
Excellent!
Great tutorial, looking forward to more advance tutorial
Thank you!
Super awesome Tim. Thank you
Glad you enjoyed it
You have helped me at work, school and even in personal projects. Thanks so much for these excellent videos! I am a much more competent programmer thanks to you :)
You're very welcome!
As always, great tutorial. Thanks.
You are most welcome. Thanks for watching.
Mr. Tim Corey, As a learner and beginner as a C# developer, I am in love with you. I learn a lot from your videos and your way of talking and explaining things is very awesome. Thank you so much for your time which you invest in people like me. May GOD bless you Sir :)
I appreciate the kind words.
I have zero experience with ClickOnce MSI or install shield. This is exactly what i have been looking for. A simple explanation of this complicated process in its simplest form. I now have a foundation to move forward and learn other techniques.Thanks!
Excellent!
Thanks Tim. I love Squirrel.
You are welcome.
Very nice lecture Tim . Crysp and clear. And i dont know anything about deployment and even Release also in visual studio. I am the basic beginner. And I could understood in clear way. Will be waiting for you next video about Releasing to the GITHUB and autoupdate from GITHUB..
Thanks!
Thank you so much. Clear and complete.
You are welcome.
Really it's a Great content... Thank You very Very much tim.
Thanks for trusting Tim for your training.
This is fantastic. Thanks!
You are most welcome. Thanks for watching.
Great Tim!...Thanks a lot
You are welcome.
Helped me so much!!!! Thanks.
You're welcome!
Hello and thanks for this very clair video :)
You are welcome.
Excellent Tim. It was just what I was looking for. Look forward to see the automated process. Although, as long as it is for a simple and small app I would rather do it manually. Next Time, show us how to place an icon for the app.
Yep, I can do that.
Tim you made my day with this implementation. It is clean and as you mention, predictable and I'd say customizable and most important of all, it can be automated MUCH MUCH easier than a clickonce app. thanks for this great video.
BTW. This worked like a charm on a WPF app.
You are most welcome. Thanks for watching.
Amazing video Tim! Thanks for all your useful delivery on this video. Now, the next step would be maybe to give the user the choice to update or not the software version and make an automatic restart if so.
wow you save me! from clickonce, now I can deploy my apps using sql ccmpact edition and cryptography that click once does not support! Thank you for this amazing material.
Glad it helped!
It's been a while since this video was made -- do you still recommend Squirrel, and is it still being supported?
Really helpfull tutorial! Thanks!
You are welcome.
Nice video Tim and thank you for sharing this valuable information as always. I have a simple question and it is as follows: does it triggers Microsoft Windows Smartscreen if it is shared to other Windows platforms? Thank you in advance!
Thank you for video. You helped me much.
You are welcome.
thanks Tim!!
You are welcome.
I enjoyed Inno Setup, But will try Squirrel this week. Thank you
Have fun!
Great Stuff!
Thanks!
Thank you so much! You are a life saver
You're welcome!
Excellent and completely understandable tutorial! I tried it on a sample app and it just works as you described. I’m building an app that needs to be shared and users by a few people in our company. This may be the way as long as people don’t object to the automatic updates. Remains to be seen. The way you drilled down to grab the version number was a feat in database acrobatics and I’m not sure how I would have found it otherwise. Very much interested in a follow up video showing more advanced usage and automation. Thanks again!
You are welcome.
thanx a lot Tim
You are welcome!
Are you still going to make the future video showing how to automate this? As well as showing an example of how to do it through a different server, thank you for the amazing content !
How to avoid SQLite-db being replaced during update of app? when I deploy a new version, the db-file are replaced with an empty db.
Don't deploy it as part of the package. Download it independently and update it manually.
Just curious, what determines the Program Group that my executable is found under? I have 3 different programs that I want to place under the same program group. 2 of them organize under my company name (in the authors field in my .nupkg file) but the 3rd which also has our company name as the author shows up under the executable name instead of the author. Any thoughts? Love it otherwise!
I have this working from an S3 Bucket - How can I test for a new release being available on the server - then notify the app that a restart is required, with a checkbox or similar?
Hi Tim, is it possible to avoid the auto start of the application after install/update? Maybe with the manifest? Tnx
Thanks Alot for helpful video.
You are welcome.
@@IAmTimCorey : I have a small question- Installer automatically installing application in C:\ Programfile \ . Can we modify setup in a way that it will prompt user to enter Installation location. For example user wants to install in D:\programfile. . Thanks in Advance :)
mr tim did u uploaded video for update from webserver as u said in this video ( 12:00 ) ?
Great tutorial. It would be great if you could show the next level with the automation of all those processes. However it is a good point to start. Thanks.
It is on the suggestion list. I'm glad you enjoyed the video.
I agree. This was great but I’m on the lookout for the next level of automation and feature usage. Thanks!
Any update on the video where we put our updates on a web server somewhere? Or maybe Azure storage accounts?
This is enormously helpful! Thanks very much, with a question: does signing one's application affect any part of this?
Again, thanks!
it was a good session. Thank you so much. One qq, how does it work in the LAN?
A part two on the build automation side would be nice also Tim. i.e how to automate the manual steps at the end i.e. moving the folders to the temp folder etc. Do you plan to do a next version?
I added it to Tim's list for topics to consider. Thanks for recommending it.
Excellent video, Tim! Do you have any tutorials on how to develop a licensing component for an app? And if the license is invalid the app won't open?
I don't have a video like that. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
Hi Tim, I have a program connected to SQL server, how can I include the SQL server in the package?!
Thanks in advance!
Thanks!
You are welcome.
I am getting an error when trying to create the using statement for Squirrel
My project is a .net v5 project. Do you have any suggestions?
Package 'DeltaCompressionDotNet 1.1.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0-windows7.0'. This package may not be fully compatible with your project.
Is it possible to add custom parameter while installing?
Awesome!!!
Thanks!
Hi Tim. Do you know how to execute "private" updates. For example the content of the Release folder is private and cannot be just passed in UpdateManager class. One potential idea is to place a web API between desktop application and the host server. Is something like this doable with Squirrel ? Thanks
You could just limit who has access to the update location.
hi. Thanks for the clear demo. I have a question. when the system is updating the latest version and consider it is taking little time based on the network speed. and the user has closed the application. so still the updation will continue in the back ground?
No, if the application closes then the update will stop. But don't worry, it will pick back up the next time without an issue. You won't get into the issue of a half-update causing issues.
how do we update via the update Task if you only have a sharepoint web link and not a file based link? Anybody try with sharepoint? can you add the code?
Great video, as always... You have used SQLite DB for database storage which makes it easy to update the database structure... Is there a way to update the sql server database for any changes that have been made in the SQL Database Project.... e.g. If I have added a new table and some stored procedures to the SQL Project, is there a way to check whether the database structure has been changed and make the necessary changes to the deployed database...
You would have to do it manually for SQLite. For SQL Server, if you use SSDT to build your database, you can have it deploy the changes as necessary.
Super helpful video Tim. Does this work with UWP apps?
No, UWP apps are a different animal. You would need to use MSIX to deploy those.
How can I set the icon for User's Desktopas well as User's Programs Menu? Please help
You set the icon for the EXE and it will be used for the icon on the desktop and start menu.
This is exactly the tool that I needed for an application I am developing. Getting my users the new versions of my program can be challenging. The background updating is awesome.
I am really looking forward to your future video showing the automatic releasing.
I am wondering what happens if the new program files not are all downloaded before the main program is closed? What if the user only has the program open for a few seconds and the network connection is slow?
A second question would be what happens if I am over writing the setup files while users program is trying to use them? Will that file be locked out somehow and be unable to be copied over?
Good questions. For the first, if you don't get the entire thing downloaded (unusual since it is a diff, not the full application), it will re-download the file. I'm not sure it will pick up where it left off in the download or not. It might. Either way, it will just work and not cause an issue.
The second question was something I should have addressed in the video. There are no problems with locked files because it puts the application in a new folder (using the version number). Then, when you restart the application, it launches the new exe in the new location. It only keeps the previous version of your application so don't worry about hundreds of applications being on disk.
@@IAmTimCorey Thanks for the reply Tim!
To clarify my second question: The step after "releasifying" using Squirrel 41:20, you copy the output files from releases and paste them over the "network location files" 42:05. Will this interfere with a user's outdated application which is trying to download the new files (maybe using "Releases" or "Setup.exe" or "Setup.ini") when I paste those files.
Additionally, what if some files are copied but others are not when the user's outdated application wants to check for updates (some kind of strange race-like condition)? Could we use the Task object to monitor the result of the update check and be sure that after awaiting the task, Task.Status = TaskStatus.RanToCompletion of something like this?
Hello.
(A little bit off-topic)
I gave an ugly name to my UI project and I wanted to change the .exe name. I've realized that changing the Assembly Name on the project properties and the Assembly Title on the AssemblyInfo.cs file does the trick without breaking the application but I'm wondering if is a good/safe thing to do because I know that messing around with file names on Visual Studio sometimes can be tricky.
It is safe to do what I did without bad/weird consequences?
I'm asking because it is my first desktop app (I'm on the final process, learning how to make a deployment/installing) and I barely understand how files works.
You can definitely rename your assembly without issues. The only problem is a project with a different name than the assembly. So the Dog project outputs Cat.exe - that's an exaggeration, but you can see the slight confusion it causes.
Hi Tim, how would one go about making file associations during the install process? ie; my program uses my own file format and I want the user to be able to launch the application when that file is opened. How could I go about setting that up?
You would need to use an MSI rather than Squirrel since this requires OS changes.
Hey there, did you ever get around to posting the automation tutorial mentioned around @8:00
Not yet. It is still on the list.
@@IAmTimCorey Hello! great tutorial, is it still on the list? or it was posted time ago?. however thanks you so much :)
Hi Tim, this is a great video. It answer all my question about creating installer and version updated. I have one problem here. I simply put my application setting into files. And this squirrel update process will created new version folder, which make me lost my setting files in old version folder. Do you have any idea to solve my problem?
I have in mind to put my setting file in different directory, but i don't know where to put it.
thanks for sharing
You would probably need to write some code to move your files into a different location and then only create them if they don't exist. As for where, that would be up to you.
How can I make a Next next finish window with squirrel? I really miss this part, where the user can change the installation folder etc...
You can't. That is part of the design. The designers of Squirrel wanted something that did not confuse or bug the users. So, no choice of installation location, no application settings can be asked for, and nothing else is asked of the user.
Hello, thanks for your great work.
I have a burning problem. How do I handle the connection string? Do I have to change it every time I'm deploying an app to another machine other than the one I used for development? Your assistance will be appreciated.
It depends. If your database is in a different location then yes. Usually your database doesn't move. It is on a server and everyone has access to it. In that case, there is no need to change the connection string.
One question how to change the connectionstring if I have to connect my app to a server ?
You would do that during the build process (a transform file). Or, if you needed to change it once it was deployed, you would need to manually update the app.config file (or you could write some code to enable your app to update it).
Hi Tim, Great video! Do you have any recommendations for a WPF project that calls on some separate python scripts, where the end user wouldn't have python installed already? Or any recommended videos?
Well you could use pyinstaller to convert the scripts into exe files, and call on those
Thanks Tim, this very
helpful. My questions are: what about prerequisites? I mean most apps have reports like crystal report or sql server express..etc. and also i usually write a code to execute the script.sql of the database on installation by
reading it from a copy i add to the project files. and adding license to the app and certificate and manifest?. are these issues available on squirrel? thanks again and
great job :)
Mostly not. Squirrel tries to tackle the 80% scenarios. If you have client-side configuration changes you need to make, you probably need a different installation solution (or you need to execute a script after the installation). Typically, you don't need to write to a database or run custom scripts after an installation. That doesn't mean you don't, it just means that scenario is in the 20% that Squirrel didn't attempt to address. That is where a more full-featured installation will be needed.
Hi Tim. I have a question. How can a create an installer for a service using topshelf. I saw you video about creating a service with topshelf, but how can I actually create an installer. Thanks in advance.
Well, you could use a bat file to do the installation. Or you could write a PowerShell script to do it. Or you could probably use an MSI file. I don't have examples to show you, though. I'll add that to the suggestion list.
Thanks for super clear video, in my case it failed and I cannot get the Squirrel -releasify step to work I get many ‘System.Exception: Failed to modify resources’ errors. I think I will go back and see if I can get the ClickOnce to work.
I would check the folder permissions and change to a local folder temporarily to test to see if that fixes the issue. It might be a pathing issue or a permissions issue.
Do you have an idea? How to add additional executable and installable files with C# installer project, that install automatically with application setup.
That would take a more advanced installer system.
Nice video easy to understand, Can we update the database file especially if it's a SQLServer database, and also what if we use the application as a network version where we have the database stored on the server, or is that to much to ask for from this free tool.
That is a lot but I'll see what I can put together for a demo for the more advanced version of this video.
can we do custom action with it? Like making copying some files from a folder to another folder, create services, create desktop items, delete some items etc. If yes then please guide me.
No, it is designed to create a self-contained installation. You would need to use an MSI file for those tasks.
i have created new project and tried to convert as nuget package using nuget explorer when place release folder file except pdb but it showing "missing symbol in nuget package explorer health -> all three component
That error is indicating it is missing the PDB files, I believe. If you are creating NuGet packages, you probably want to distribute the PDB files with the packages so that your users can debug issues.
I want to integrate this with a CI/CD system (TeamCity) which makes a release for each checkin, but does this mean that I need a script that manually modifies the version in AssemblyInfo.cs? It feels a little... weird to modify that file every time. I'll see if that file can load the version from a text file (which I auto-generate) or something.
This solution should point you in the right direction. Essentially, you should be able to use MSBuild to update it for you: stackoverflow.com/questions/14254554/how-to-update-the-value-in-assemblyinfo-cs-dynamically
@@IAmTimCorey Seems sensible, thank you!
Just curious, when the startup icon fails to launch the app, how do you debug the updater ? It starts up fine in VS but the updater is failing. Probably a missing file or something but is there a log file generated somewhere?
Thanks
I believe there should be a log generated in the folder with the application. Also, check the event logs for any further details.
@@IAmTimCorey Thanks Tim. The Squirrel log is always empty and I'm not sure what the issue is with the EV. When the error occurs .. the EV (windows/applications) does not report any error from Squirrel. I'll work with internal code logging for help. Thanks Tim (Nice Presentation BTW).
I followed along closely, but for some reason, when I launch the app after releasify-ing and copying the setup files to the C:\Temp\Releases folder, the app never seems to update itself. Am I missing something easy? If I run setup.exe after copying them, the app does get updated with the updated code. So for some reason, launching the app isn't running the update. I tried removing the async but that didn't change anything. Help!!!
Hmmm, it sounds like the code that checks for the updated version isn't running. Maybe put it behind a button and manually launch it to see if that changes anything. Don't forget that the first time you launch the application after updating it, it will still be the old version. Just close it and re-open it after a couple seconds and you should have the new version.
Is it possible use squirrel to create a setup.exe for launch another application developed in Delphi ? I mean now iam using advanced installer to create an .msi, for launch my delphi application but i would like to do this using squirrel
Hi,
I got my app (wpf with a SQLite-db) to work using Squirrel according to your video.
But when make a new version, the db-file are replaced with a new and empty db.
If i remove the db file in the newest nupkg the app will fail due to the db is deleted during the automatic update.
Would it help to change the properties for the db file to "Do not copy" before building the solution i Visual Studio ?
Anyone who can help me ?
Yeah, I'm going to come back to that to improve the deployment at some point. If you deploy the database with the application, it will work as long as you don't update the database with the application (or if the application is used just for caching data or other short-term uses). Otherwise, you need to script the database updates instead of deploying a whole new file.
Just one like button is not enough, it should be 1,000,000. Thank you, Tim.
You are most welcome. Thanks for watching.
Hi Tim, I'm trying to make updates over the internet, but I couldn't do it somehow, can you make a short video about it.
This video shows how to do updates. The only difference is where you point to. It sounds like maybe the updates weren't made public or something.
Hi Tim, did I got this straight: The use case would be, to give the updatemanager a URL, where it can find the new version on a public web reference?
Yep. That way it could update your app regardless of where you app was located (not even on the same network).
I’m not finding any follow up videos where you go more in depth, such as using a URL for the update location. Did you ever make any update videos?
-Thanks.
Not yet. It is on the list but I've got a ton of videos that I need to get to.
I tried using URL from IIS Server and failed with 404 error but works perfectly if i try local path. Please if u have any video on URL kindly notify me. Thanks
I am using VS2015 Community, and I cannot browse the Squirrel in nUGets, can you please tell me why I cannot find it? Thanks
Are you looking for squirrel.windows? Other than that, I don't know. It might be an issue with your older version of Visual Studio but I doubt it. By the way, do you know you can upgrade for free at www.visualstudio.com ?
that works well :) but i hope if there's way to change the installation from applocaldata location
still searching for it
That really is outside the purpose of Squirrel. Its goals are to be fast, silent, and not pop up a UAC dialog on installation. Trying to specify a different location for installation could cause the UAC dialog or it could not exist or you would have to prompt the user. All of these options violate the goals of Squirrel. If you really need a different location, Squirrel isn't the right installation package for you. Here is a bit more on that subject: github.com/Squirrel/Squirrel.Windows/pull/1067
My setup.exe never works. I create the nuget package, releasing to a directory, run it and it crashes or errors. I would appreciate some help with this.
Not sure why. My guess is that you missed something small.
how to make installer in inno using result file from squirrel ?
Those are two different installers. Create one or the other.
Is possible to create a progress bar showing the progress of my update?
Nope. The design of the updater is to be silent and unobtrusive.
Just wondering how this is better than ClickOnce. I was able to get ClickOnce deployment with self-updating from intranet site working perfectly. The only downsides with ClickOnce are inability to create Test vs Prod versions of the same application and when an update is forced via the minimum required version, it cannot be easily reverted (without publishing another new version and incrementing the minimum required version again). What was it about ClickOnce that made you go down this path?
There are a couple things, including the fact that ClickOnce seems to be touchy. Rollback is easy, no UAC is nice, background updates, easy package creation and hosting, and a lot more. The bottom line is it felt simpler with more power vs. ClickOnce. That isn't a knock on ClickOnce though. If you find it works for you, I don't see any reason to switch.
For application upgrade... How we can handle if SQLite schema change?
Thanks in Advance :)
Thanks, I added it to my suggested topics list.
Hi Tim, do you have any idea how to attach excel templates which would be installed on the user's local drive? I'm currently sending msi application with files included in the installation package and while installing the application - several excel files are loaded to the users' local folder. Thanks.
That's probably the best way, although you could have C# create/download them if they don't exist.
@@IAmTimCorey Thanks!
Squirrel.Windows is installed via Visual Studio's built-in NuGet package manager but I can't do using Squirrel; and ctrl+dot on UpdateManager doesn't suggest anything helpful. I have no idea why the Squirrel namespace doesn't seem to exist even after installing the package. This is very confusing and frustrating!
try to downgrade to 1.9
that seems to be the last one working. I tried too
Then rebuild your solution. Good luck
Hello Tim,
A great tutorial as always,
Squirrel however doesn't support .Net Core as far as I know.. Is that true? and is there a work around or an alternative?
Squirrel doesn't really care about .NET types. It is a .NET Framework installer, meaning that is what powers it, but it can install pretty much anything. You can install .NET Core projects or even Java projects with Squirrel.