I've finished an application in C# using Visual Studio 2022 and need to make an installer for it. I used Microsoft Visual Studio Installer Projects extension and could create the installer which works fine. But I need something else: during instalation, it's necessary to create a folder, then a file and save this file into that folder. But I don't know how to do this in this installer. Does anybody has a solution for this? Thanks.
Loading
Rajanikant HawaldarPosted Sep 20, 2022, 2:18 AM
Add that dll from nuget
Ismael OliveiraPosted Sep 19, 2022, 10:38 PM
Rajanikant.
Your suggestion seams to be OK, but when I try to add new item, then Installer class (which adds the line:
using System.Configuration.Install;), I receive the message "The reference 'System.Configuration.Install' couldn't be added to your project". Do you have an idea of what it means? Is it a matter of versions?
Sorry to disturb you, but the answer is almost here. Thank you again.
Rajanikant HawaldarPosted Sep 17, 2022, 11:18 AM
Check below article, they starting service after install setup and stopping service after uninstall setup, similerly you can do do override methos like Install, etc as below
The installer.cs class has many method to override you can use as per your need
https://www.c-sharpcorner.com/article/how-to-perform-custom-actions-and-upgrade-using-visual-studio-installer/
Rijwan AnsariPosted Sep 17, 2022, 5:19 AM
Alternatively, you can write code in main form load to run first time and create a folder and a file.
Something like below:
Amit MohantyPosted Sep 15, 2022, 10:51 AM
Hey check the below link, this may help you
https://www.c-sharpcorner.com/UploadFile/27c648/create-a-custom-setup-for-change-app-onfig/
Ismael OliveiraPosted Sep 13, 2022, 1:55 PM
Rajanikant.
Thanks for your answer. But I didn't understand what you mean by ==> installer file, then override methods. Could you detail this idea for me? Thank you again.
Rajanikant HawaldarPosted Sep 13, 2022, 3:41 AM
if want to do something during installation then go to setup solution right click add new item => Installer file then override methods(Committed, Install, Commit, Rollback)