how to add logic to msi installer - visual-studio-2010

I have a Setup Project in Visual Studio 2010 which creates a .msi installer. I am wondering if it is possible to add some logic to check some conditions. e.g if there is my software installed yet.
Thanks,

This is done through installer properties. You can set them and check them against values. They are just like variables in code.
However, Visual Studio is limited when it comes to custom installation logic. If you don't figure out how to do what you need, give us more details.
As a side note, launching the installer for an already installed product makes it go into maintenance mode (Modify, Repair and Remove options). So you don't need to check if your application is already installed.

You need to add installer class to one of your library or assembly. In Visual Studio, attach installer events to custom action. See how http://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup---projects-and-custom-actions/ or here http://msdn.microsoft.com/en-us/library/d9k65z2d.aspx

Related

Visual Studio Installer Projects product name diacritics

I am using Microsoft Visual Studio Installer projects extension to create an installer for my app.
Works OK, but the problem is that the product name contains "ลก" character in it and the font used in the msi installer obviously doesn't support that character:
Anything I can do about that?
Some background info:
I initially developed the app in VS 2015 which had a free Install Shield Limited edition. Or maybe it was even VS2013, don't really remember... However, now I need to make some changes in the app. There was no problem with such a name in Install Shield back then. So I tried to open the project in VS 2022, but obviously Install shield's no longer an option. This is where VS Installer project comes in, but there's the problem with the diacritics...
This looks like an encoding issue. Try searching in the VS project properties for an option to set the encoding to Unicode. I don't use the VS projects that much, so I don't know if you have the option to change it not, but it might be there.
Also, if you are looking for a better free MSI packaging tool, try the Advanced Installer extension for Visual Studio. There is one for each version of VS.
Disclaimer. I work on the team building Advanced Installer.

Selectable components in Visual Studio 2013 Setup Project

I have created a Visual Studio 2013 Setup Project that installs a Windows Service. Everything works fine up to now, but I need to add an additional component to the installation. This component should install if the user wishes, so, I need something like a selectable component that the user can check its installation if it is desired. I searched the web but not happy results, I don't know if it is possible to do with the Basic Visual Studio Setup Projects Template. I need to know if it is possible, or if I need to move to other Installer's maker like Wix or Installshield. If it is possible, please explain how to achieve it. Thanks

How do you run custom code and display a dialog box when using Visual Studio installer?

Looking at VS2010 installer I saw a way to hook in macros and created a test macro but my test macro didn't show up in the list. I also briefly tested InstallShield LE but it didn't meet all my requirements and I went away for a couple of days and when I returned it said the project had expired. This is a simple one-off install so I'd rather not spend the $$ for InstallShield pro.
What is the best way to call some custom code and display a dialog box pre/post install within VS2010 or VS2008 installer?
Visual Studio setup projects do not support this. To use custom actions before or after the actual installation you can use a different setup authoring tool.
If you want a free solution you can try WiX. It has a steep learning curve, but it gets the job done.
For commercial tools you can see this list: http://en.wikipedia.org/wiki/List_of_installation_software
This isn't a really scalable solution per say but a useful hack when you don't want to spend money for the full featured tools. You can build your MSI using a Visual Studio Deployment Project or InstallShield LE project and then use post build steps to perform automation to modify the MSI to do things it wasn't authored to do.
If you understand the MSI table data you can edit the MSI in Orca, create a transform, author your dialog and then generate the transform file. Then everytime you build your MSI you just use a postbuild command to apply that transform to your MSI as if VS authored it.
You might, cough cough, be able to find someone around here to help you do that on the cheap.

Adding a service installer and service process installer in visual studio

For some reason, after adding a Installer class to my Windows Service project, I open it up in design mode and right click, but there is no option to add either a service installer or a service process installer. Does anyone know why this may be the case?
In both Visual Studio 2008 and 2010, the best way to do this is to open the ServiceBase component (named Service1 by default) in design mode. Then, right-click in the designer and select the Add Installer option. This adds a ProjectInstaller component along with the necessary assembly references. The ProjectInstaller component, in turn, has the service installer and service process installer added automatically.
Without additional detail, my best guess is that you manually added a component/class to your project and named it Installer instead of letting Visual Studio do the work for you.
See my post here for how to create a basic service in Visual Studio 2008 (seems to work in 2010 as well). Pay particular attention to Step 6.
Hope this helps.

How to customize an installer's UI

I am building an installer for my windows app and have done this through a setup/installer project in visual studio.
I was wondering how to customize he UI of the finish dialog box? I want to add a couple of check-boxes and launch an app after the user closes the finish box.
Is there a way to do this in Visual studio itself or does it require any other tools? If other tools are required then are any of them free?
Thanks
Kapil
Visual studio deployment projects give you some standard templated dialog boxes.
If none of these templates meet your requirements, you can create your own custom UI and use an installer class to control the workflow.
To launch an app at end of the installation you would again probably have to override a method in your installer class.
If all this seems like hard work, it's certainly worth looking at something like INNO Setup or WIX.
Inno Setup is free and has the ability to run things when the install is complete.

Resources