Reputation: 20002
I have created an application (C#, Windows Forms) on Visual Studio 2008, and now I want to make installer of this application. How can this be done?
I want my installer to
How can I do it?
Upvotes: 76
Views: 193374
Reputation: 119
For Visual Studio 2022 Community, you have to add Microsoft's Installer package separately. It's available for free from the VS Marketplace.
Upvotes: 7
Reputation: 1141
Why invent wheels yourself while there is a car ready for you? I just find this tools super easy and intuitive to use: Advanced Installer. This one minute video should be enough to impress you. Here is the illustrative user guide.
Upvotes: 3
Reputation: 21918
There are several methods, two of which are as follows. Provide a custom installer or a setup project.
Here is how to create a custom installer
[RunInstaller(true)]
public class MyInstaller : Installer
{
public HelloInstaller()
: base()
{
}
public override void Commit(IDictionary mySavedState)
{
base.Commit(mySavedState);
System.IO.File.CreateText("Commit.txt");
}
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
System.IO.File.CreateText("Install.txt");
}
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
File.Delete("Commit.txt");
File.Delete("Install.txt");
}
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
File.Delete("Install.txt");
}
}
To add a setup project
Menu file -> New -> Project --> Other Projects Types --> Setup and Deployment
Set properties of the project, using the properties window
The article How to create a Setup package by using Visual Studio .NET provides the details.
Upvotes: 11
Reputation: 9607
Upvotes: 72
Reputation: 115691
Generally speaking, it's recommended to use MSI-based installations on Windows. Thus, if you're ready to invest a fair bit of time, WiX is the way to go.
If you want something which is much more simpler, go with InnoSetup.
Upvotes: 19