VB.NET: Create an installer program
Solved
Anonyme209
Posted messages
761
Status
Member
-
Anonyme209 Posted messages 761 Status Member -
Anonyme209 Posted messages 761 Status Member -
Hello,
I would like to know how to create an installer program in VB.NET. I’m not talking about the Visual Studio setup project type; I want to program it as a Windows Forms application. So I need:
- That the program is considered an installer (for example, when an installation of a program fails, Windows shows the message "This program might not have installed correctly.")
- That the program to be installed appears in the Programs and Features list (i.e., it is considered an installed program).
Thank you for your help.
I would like to know how to create an installer program in VB.NET. I’m not talking about the Visual Studio setup project type; I want to program it as a Windows Forms application. So I need:
- That the program is considered an installer (for example, when an installation of a program fails, Windows shows the message "This program might not have installed correctly.")
- That the program to be installed appears in the Programs and Features list (i.e., it is considered an installed program).
Thank you for your help.
2 answers
-
Hi,
The simplest option would be to use an installer program like InstallShield, but there are also free alternatives such as excellent Inno Setup. -
Hello,
That doesn’t answer my question.
I didn’t ask for software that would create installer programs for me, I asked how to create my own installer program in VB.NET, without using the "Setup" project type.
The programs you cited don’t allow full customization of the program.-
Yes, these programs are very powerful and allow you to fully customize the installer; they are specialized tools, but real development tools, they’re made for that. So either you use them and do a very good job quickly, or you try to recreate the same thing in VB.NET, but it will be 100 times longer and 100 times harder—your choice.
-
In this case, explain to me how to do it with Inno Setup:
- Customize the window (size, color, etc.)
- Choose the uninstallation code (for example, delete a folder, a registry key, etc... NOTE: With this example, the folder or the key will not necessarily be created during installation, but by the installed program).
- Add options during installation/uninstallation (for example, specify a username, add a checkbox, etc.) -
There isn’t everything, but it will give you an idea: Inno Setup Tutorial, for advanced features check the tool itself and the documentation.
-
-
Hello, First, generate a random GUID. In order for the program to appear in the list of programs and features, create the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\
Then, inside this key, create (at least) these values: DisplayName // (the application name) DisplayVersion // (the application version) InstallDate // yearmonthday without spaces: 20151706 Publisher // (the creator's name) UninstallString // (the path to the uninstaller file, if created) Additional values: HelpLink // (the Internet link to an online help page, if any) URLInfoAbout // (the potential Internet link with information about the application) URLUpdateInfo // (the potential Internet link providing update information) NoModify // (if set to 1, the "Modify" option will not appear in the control panel for this application) NoRepair // (if set to 1, the "Repair" option will not appear in the control panel for this application) Then, for shortcuts, I found this code: Dim WSHShell = CreateObject("WScript.Shell") Dim Shortcut = WSHShell.CreateShortcut("raccourci.lnk") With Shortcut .TargetPath = WSHShell.ExpandEnvironmentStrings("adresse_executable_application.exe") .IconLocation = WSHShell.ExpandEnvironmentStrings("emplacement_icone_raccourci", 0) .Description = "description_application" End With Shortcut.Save() (It must be adapted to avoid recreating the shortcut on application update) Finally, you just need to create the installation folder and copy the application files there. When the said files are imported into the project resources, do: My.Computer.FileSystem.WriteAllBytes("folder\nfilename.extension", My.Resources.File, False) If you want to create an uninstaller program, simply have it delete the registry key, the shortcuts, and the installation folder created.
-