Click here to monitor SSC
  • Av rating:
  • Total votes: 195
  • Total comments: 63
Phil Wilson

Visual Studio Setup - projects and custom actions

07 June 2005

Second in a series on Visual Studio setup. This article describes the kinds of custom actions that can be used in your Visual Studio setup project.

Introduction

It’s often necessary to add your own code to a Visual Studio setup project, which is accomplished using custom actions. Custom actions are in contrast to the standard actions that Windows Installer performs during an installation. Examples of standard actions include copying files and registering COM servers.

(You can download the code examples to go with this article using the link to the right of the title.)

Properties and CustomActionData

To understand the use of custom actions, it’s important to know how to use Windows Installer properties, and in particular the CustomActionData property. To pass data into your custom-action code in Visual Studio setup projects, for example, you set the CustomActionData property to the data you want to pass into the custom action, and in your code you retrieve the CustomActionData property that contains the data. This is a common theme in the examples that follow.

Remember that the properties can be standard Windows Installer properties (TARGETDIR, VersionNT and so on), or properties that you created yourself, perhaps by using Search Target Machine as we saw in the previous article.

We’ll illustrate this CustomActionData idea with a simple VBScript custom action. This custom-action script will display the value of the CustomActionData property:

msgbox Session.Property("CustomActionData")

In the Visual Studio IDE for the properties of that custom action, you specify the value of your CustomActionData. In this example you’ll do this:

[OriginalDatabase]<>[TARGETDIR]<>[ComputerName]

You’re passing the value of this string to the CustomActionData property, and then in the custom-action code you get the value from the CustomActionData property. That is, you’re passing this data indirectly via the CustomActionData property.

The data consists of three Windows Installer properties. TARGETDIR is the primary installation folder, OriginalDatabase is the full path to the current MSI file being installed, and ComputerName is the name of the computer. Since angle brackets are not allowed in file names, they can serve as separators for parsing the combined properties and separating them out. So angle brackets are used for passing multiple property values into a custom action. Square brackets indicate that the actual value will be resolved at run time.

One caveat: Anti-virus software sometimes intercepts VBScript code and could prevent your custom action from working properly.

With the basics in place with regard to properties and CustomActionData, we’ll look at other types of custom actions.

C++ custom action DLL

You can write custom actions as C++ function calls in a DLL. These function calls must be exported and have a signature like this:

UINT __stdcall SomeCA (MSIHANDLE hInstall)

The MSIHANDLE parameter is similar in concept to the Session value used in the earlier VBScript custom action. The MSIHANDLE enables you to access properties using the Win32 MsiGetProperty API call, so we can code a complete custom action call like this:

UINT __stdcall SomeCA (MSIHANDLE hInstall)
{
WCHAR vbuff [500] = {0};
DWORD vlen = 500;
UINT gp = MsiGetPropertyW(hInstall, L"CustomActionData", vbuff, &vlen);
WCHAR msg [500] = {0};
wsprintfW (msg, L"gp = %d vlen = %d vbuff = %s", gp, vlen, vbuff );
LogMessage (hInstall, msg);
MessageBoxW (NULL, msg, L"Result", MB_OK);
return 0;
}

You can do much more than just get properties. There is an MsiSetProperty API, for example, that can set a property you can use later in the install or in another custom action. If the property name you specify does not exist, Windows Installer will create it for you. I’ll describe what that LogMessage call does in a moment.

You’ll need to include msiquery.h and link to msi.lib to use C++ custom actions. Use of an explicit .def file that names the exported functions will save you from potential name-mangling issues.

One of the useful features of these direct call custom actions (in which your code is called directly from Windows Installer) is the ability to write your own entries to the Windows Installer log. The LogMessage function below shows how to do this fairly easily in your C++ custom-action DLL, especially if you ignore error checking as I’ve done here:

UINT LogMessage (MSIHANDLE hInstall, LPCWSTR szMsg)
{
PMSIHANDLE hRecord = MsiCreateRecord(1);
MsiRecordSetStringW(hRecord, 0, szMsg);
MsiProcessMessage(hInstall, INSTALLMESSAGE(INSTALLMESSAGE_INFO),
hRecord);
return ERROR_SUCCESS;
}

You don’t get the logging output by default. You have to enable it at install time with a command line like this:

Msiexec /I
/l*v myinstall.log

You would see a few lines like this in the log file:

MSI (s) (A0:80) [10:48:48:049]: Invoking remote custom action. DLL:
C:\WINDOWS\Installer\MSI15E.tmp, Entrypoint: SomeCA


gp = 0 vlen = 35 vbuff = C:\Program Files\PhilW\InstWinForm\

The first line is a standard logging entry reporting that the custom action is being called; the second line is the output from the call to LogMessage in the custom action. This is a useful debugging technique for tracing the path of your custom-action DLL calls.

Figure 1

But why does it say that the custom-action DLL is called MSI15E.tmp? Look at Figure 1, which shows the properties of the custom-action DLL in Solution Explorer. It has an Exclude property value of True. This means that the DLL isn’t being installed. Rather, the DLL is stored in the MSI file and streamed out when the custom action is called, so that unusual name is your custom-action DLL.

Calling an executable as a custom action

Visual Studio also lets you use an executable as a custom action. You can’t use CustomActionData to pass values to the program, because you’re not passing properties via a call directly from the Windows Installer Service. Instead you can use the arguments value shown in Figure 2, the properties window of a custom action, to call the forms program executable in the sample Visual Studio solution. The argument string is surrounded by quotes so that it gets passed as a single string into the main of the receiving program.

Figure 2

Because this call is synchronous, you can’t use it to launch your application after the install: While the custom-action program is running, the install process waits for it to finish.

Installer classes

.NET assemblies can contain installer classes, and Visual Studio .NET lets you call methods in these installer classes as custom actions. If you select a .NET project in the Solution Explorer, a right-click lets you add a component, one of which is an installer class. The boilerplate code generated for you includes an attributed class with [RunInstaller(true)], which is what makes it an installer class. To add code of your own, override the existing class methods and use the install method shown here:

public override void Install(IDictionary savedState)
{
base.Install(savedState);
// Add your code here
}

This is where you add your install code. You should also add a corresponding uninstall method that reverses whatever your install code does to the system.

Figure 3

By adding a custom action in the same general way as described earlier, you add these calls as custom actions in your setup project. Figure 3 shows the properties for the custom action. Note that the InstallerClass property is set to True. Figure 3 also shows how to pass CustomActionData into your installer class methods, but it’s not the same format as other custom actions. Here’s a sample CustomActionData string:

/targ="[TARGETDIR]\"

This is the general format required for passing data into installer classes. You must put quotes around Windows Installer folder properties so that the internal parsing works correctly. The parameter string ends up in Context.Parameters of the installer class, an IDictionary object with keys and values, and there will be a key corresponding to your CustomActionData key (targ in the example). This means that there will be a this.Context.Parameters["targ"] key with a value of TARGETDIR resolved to the run-time value.

You can enumerate through these context parameters with the following code, which is intended to be called as a debug method passing "Install" as the string parameter if it’s being called from an install custom action:

private void ShowContext(string where)
{
StringBuilder sb = new StringBuilder();
StringDictionary myStringDictionary = this.Context.Parameters;
sb.Append("From " + where + "\n");
if (this.Context.Parameters.Count > 0)
{
foreach (string myString in this.Context.Parameters.Keys)
{
sb.AppendFormat("String={0} Value= {1}\n", myString,
this.Context.Parameters[myString]);
}
}
MessageBox.Show(sb.ToString());
}

This will give you a message display as shown in Figure 4. There is a "targ" key where the value is the install folder TARGETDIR, and there is an assemblypath key with the install path of the assembly. This is a useful alternative to passing TARGETDIR because it tells you the path to the assembly. This is not documented anywhere, so I do not recommend that you rely on it in different versions of Visual Studio, because it’s being passed in as part of the internal implementation of installer classes.

Figure 4

The installer class mechanism isn’t native to Windows Installer – there’s no support for calling installer classes directly from the Windows Installer Service. Visual Studio packages a shim DLL into your setup and generates a call to the ManagedInstall function in this DLL, passing parameters via CustomActionData in the same way as the custom action call into a C++ DLL that you saw earlier. This shim DLL is then responsible for finding and calling your installer class methods, and ultimately .NET reflection is used to locate your installer class with its [RunInstaller(true)] value. This is why assemblypath is passed in, as we just saw in Context.Parameters.

The installer class mechanism isn’t as versatile as writing your own C++ custom-action method because you are a calling layer away from the install process and you don’t have access to the MSIHANDLE in your installer classes like you do in a C++ function. So you can’t set installer properties, only pass them one way into your class methods.

Installer classes prompt you to install Windows Services using the ServiceInstaller class, although installing services using custom actions is rather unusual in the Windows Installer world. Most third-party install tools provide IDE support for the ServiceInstall and ServiceControl tables that are standard features of Windows Installer and are provided for the very purpose of installing services.

(Important note about the installer: As detailed on the Microsoft support site, Visual Studio .NET setup projects execute the custom action of the previous version when upgrading. See http://support.microsoft.com/default.aspx?scid=kb;en-us;555184 for more information.)

When is my custom action called?

There are no clues in a Visual Studio setup project that tell you when your custom action is called. Before explaining that, however, I’ll describe the three stages of a Windows Installer setup:

  • A user interface sequence during which data is gathered (file locations, choices and so on) and the system is not being changed.
  • An auditing sequence in which the actions that will be done are written to an audit file, and the system typically is not yet changed.
  • An updating sequence in which the audit script is processed and changes are made to the target system.

The reason for the audited nature of the process is apparent if you’ve seen a Windows Installer setup fail and roll back. What’s happening is that the changes made to the system are backed out with the help of that audit script. It’s a feature of a Windows Installer setup that a failure will restore the system as if the install had never started.

Visual Studio custom actions are called during the third stage of the setup. It should be apparent that you can’t use install custom actions in Visual Studio to make significant changes to your setup, because by the time your custom action is called, the install is almost finished and it’s far too late to change something like TARGETDIR. On the other hand, install custom actions are called toward the end of stage 3, and that means that your files, program executables, and data are installed on the target system and you can use them.

If you want to run one of your programs or make modifications to a configuration file, it’s helpful that these files have been installed by the time your install custom action runs. Also, the user interface can be suppressed in a command line install, so it wouldn’t work well to call the custom actions from the user interface sequence.

Custom actions that are called during stage 3 are known as deferred custom actions in Windows Installer, and it’s the internal handling of these custom actions that requires use of CustomActionData to pass data to them. The installation process is actually a client/server environment in which the user interface runs on a user-mode Msiexec.exe and the server installation process runs on the Windows Installer Service Msiexec.exe.

It’s normal to see two or more copies of Msiexec.exe running at the same time because of the client/server architecture, among other factors. During the service part of the installation process, there is limited access to installer properties, and this is why properties are passed to our deferred custom actions using the CustomActionData property.

During stage 2 the CustomActionData values are prepared so they can be used in stage 3. This client/server architecture is also related to property naming. When Visual Studio prompts you for a property name, the names are uppercase. Because Windows Installer properties can be private or public, public properties are denoted with uppercase names. There are two main attributes of public properties that concern us here: They can be passed from the UI sequence to the execution sequences, and they can be specified on a command-line install.

The first attribute is critical when properties are created during something like a Search Target Machine (see the first article in this series). Because Search Target Machine is implemented as a Windows Installer AppSearch action, it will be processed early in the UI sequence (stage 1) or the execute sequence (stage 2), but not in both. So a property that the search creates is public so it can be passed from the UI sequence to the execute sequence.

When you want to do a command-line install and pass in a value for TARGETDIR, for example, use something like this:

Msiexec /i
TARGETDIR=c:\MyFolder

You can’t get a property in VBScript with Session.Property("TARGETDIR") because of the behavior of Visual Studio’s deferred custom actions and CustomActionData. If Visual Studio custom actions were called during stage 2, you would be able to use properties like the one mentioned above, known as immediate custom actions in Windows Installer, but your files wouldn’t yet be installed on the system.

In other words, the Visual Studio design restricts you to custom actions that are called when your files are on the system (deferred custom actions), which means that you must use the CustomActionData property. Other tools that generate MSI files are often more flexible, so if you anticipate complex setups, investigate those tools.

It’s important to understand where your Visual Studio custom actions fit into the installation process and how that affects the kind of thing you can do with them. You should think of Visual Studio install custom actions as occurring after the install.

It’s worth noting that Windows Installer doesn’t know whether a custom action is an install or an uninstall, which is how custom actions appear in the Visual Studio IDE. Visual Studio adds a condition to the custom actions that is true on an install or an uninstall, but you can’t see it in the IDE. If you add your own condition, it’s added to the existing condition with an "and." The importance of this will become apparent when we look at repair in the next section.

Beware of repair

Visual Studio creates a Windows Installer component for each file being installed. When the component is installed, the file is installed. It’s crucial to understand that your custom-action call is internally conditioned on that component being marked for installation, because when a repair occurs the component may be marked for reinstallation. That is, a repair can call your custom action again.

This is easy to see if you install an executable that is the target of a shortcut as well as the subject of an install custom action. If you remove the executable and then use the shortcut, a repair will kick in. The repair will install the component, your custom action will be called, and you’ll see your executable run as a custom action. When you close it down you’ll see it start again as a result of your original shortcut request.

The key point is that your file is reinstalled by the repair. Your custom action, conditioned on the Windows Installer component containing that file, is also being called. You probably expected your custom action to be called only once when your product was installed, but as you see it may be called again. I’ll explain how to fix that in a moment.

Take another look at Figure 1. It shows the CADll custom-action DLL and the VBScript custom action with the Exclude property True in the properties pane in the Solution Explorer pane (note the circle with a line through it in both cases). So the file won’t be installed, as we described in the C++ custom-action DLL. The DLL and the VBScript are packaged separately in the MSI file, streamed out into a temporary location, and run from there.

I just mentioned that an install custom action is conditioned on the component being installed, which is why it also gets called during a repair. But CADll and showprop.vbs aren’t being installed because they’re excluded! So what makes this an install custom action? The internal condition is that the custom action is called if this is not a complete uninstall of the product.

The last key piece of information is that a repair ensures that the entire feature is installed, and Visual Studio setup projects have a single feature. If you look at Figure 1, during a repair the WinForm.exe custom action is called if it is reinstalled, because it’s conditioned on the file/component being marked for installation. Showprop.vbs (and CADll.dll) will also be called because their conditions are based on "this is not an uninstall." So all your custom actions might be called during a repair.

I’ve spent a lot of time on this because it can cause awful problems. You might do a repair from the context menu of an MSI file and your custom actions will run again. If you were creating a database from scratch, that’s a big problem!

The solution is to add an extra condition to the custom actions to prevent them from being called during a repair. The condition is "Not Installed," where "Installed" is a case-sensitive Windows Installer property that’s set if your product is already installed. In other words, during a repair your product is installed and it’s just being repaired, so "Not Installed" ensures that you run your custom actions once during the first install. Figure 5 shows this condition in the custom-action properties.

Figure 5

Conclusion

Custom actions are a useful way to add functionality to your Visual Studio setup projects, so it’s important to understand how to use them and their capabilities. I hope this article will help you to use them successfully.

Phil Wilson

Author profile:

Phil Wilson is a software engineer at Unisys Corporation in California, a Microsoft MVP (Most Valued Professional) and author of The Definitive Guide to Windows Installer, Apress, 2004.

Search for other articles by Phil Wilson

Rate this article:   Avg rating: from a total of 195 votes.


Poor

OK

Good

Great

Must read
Have Your Say
Do you have an opinion on this article? Then add your comment below:
You must be logged in to post to this forum

Click here to log in.


Subject: Just a comment
Posted by: Anonymous (not signed in)
Posted on: Tuesday, July 18, 2006 at 6:30 AM
Message: I've been diving on the net looking for accurate info about CustomActionData values and this is the first article where it's cleary explained. And the best of all, Phil's examples do work correctly!

Subject: Patch repair
Posted by: Anonymous (not signed in)
Posted on: Thursday, July 20, 2006 at 2:27 AM
Message: I was searching for an user interface editor to open while we do patching.Now I could find another option from your article, how to prevent custom action execution.Thanks a lot.

Subject: saving action data
Posted by: Anonymous (not signed in)
Posted on: Thursday, August 17, 2006 at 12:53 PM
Message: how can i save action data at install time and retrieve them at unistall time?

Subject: can i install a windows service using VS.NET setup?
Posted by: Anonymous (not signed in)
Posted on: Friday, September 29, 2006 at 7:11 AM
Message: can i install a windows service using VS.NET setup? and if yes then how..?

thx

Subject: Great Article
Posted by: Anonymous (not signed in)
Posted on: Tuesday, October 3, 2006 at 5:39 AM
Message: I have searched abt custom action and i cudnt find it any where on net..iam glad that i found here and it has solved my problem. thank you

Subject: Very helpful article
Posted by: Anonymous (not signed in)
Posted on: Wednesday, October 18, 2006 at 12:27 PM
Message: You do a great job of providing a complete look at all the options. Thanks for putting this out there!!!

Subject: Can i Install DBScripts during Setup ?
Posted by: Anonymous (not signed in)
Posted on: Friday, October 20, 2006 at 2:29 AM
Message: Hi Phil.
Firstly i want to thank you for putting up such a nice article. My only question here would be that can i take the user's database credentials during the setup and install all the associated dbscripts along with my web application.
Thanks.
Mrunal Nagrecha

Subject: when I found this Custom Action
Posted by: Anonymous (not signed in)
Posted on: Friday, December 8, 2006 at 4:20 AM
Message: I do not see where i found these custon action.
yes in windows installer 2.0 but where I can find it/

Thanks.

Sabine Spronck

Subject: Very very helpful
Posted by: Anonymous (not signed in)
Posted on: Friday, December 8, 2006 at 9:55 AM
Message: This article kept me from pulling all my hair out. Thank for putting it out there.

Subject: get an error
Posted by: Anonymous (not signed in)
Posted on: Friday, January 19, 2007 at 7:51 AM
Message: hi,
i've get an error when i put the quotes in custom action data :
/vparam="[TARGETDIR]"

without quotes it works well, but what to do if user inserts a string with spaces? (in this case it tells that the dll file doesn't exist!!)

Subject: get an error
Posted by: Anonymous (not signed in)
Posted on: Friday, January 19, 2007 at 9:08 AM
Message: hi,
i've get an error when i put the quotes in custom action data :
/vparam="[TARGETDIR]"

without quotes it works well, but what to do if user inserts a string with spaces? (in this case it tells that the dll file doesn't exist!!)

Subject: get an error
Posted by: Anonymous (not signed in)
Posted on: Tuesday, January 23, 2007 at 5:54 AM
Message: Try

/vparam="[TARGETDIR]\"

I don't know why, but the extra backslash worked for me.

Subject: good post
Posted by: Anonymous (not signed in)
Posted on: Wednesday, January 24, 2007 at 8:41 AM
Message: This is actually a very nice post. I took some ideas in how to do my own work. Thank you!

Although I think the way to get the installation folder path is a work around, I'd like to get direct access to all dialogboxes and not only to those that we add to the User Interface.

Nevertheless this was the best post to solve my problem

Subject: How can I install COM+ component using windows installer?
Posted by: Anonymous (not signed in)
Posted on: Friday, February 2, 2007 at 12:32 PM
Message: This is a nice article. Could you pls tell me how can I install com+ component using windows installer.

Subject: being helpful is a symbol of being rich
Posted by: Anonymous (not signed in)
Posted on: Thursday, February 8, 2007 at 1:58 PM
Message: That was cool and pretty helpful,pls discuss about VS environment and the utilities built in it more and more.i think there are people like me that does not have enough information about the VS ambience.

Subject: Installing an MSI within an MSI
Posted by: Anonymous (not signed in)
Posted on: Tuesday, March 13, 2007 at 1:17 PM
Message: This article along with your book, The Definitive Guide to Windows Installer, have gone a long way toward helping me build an installer for the application I am deploying. Along with the application I am installing, I have a couple of third party dependencies I would like deploy at the same time. One of them is an MSI, and you explained that two MSIs cannot install simultaneously. So how can I accomplish this from one installer or make it appear to be part of one seamless install sequence?

Thanks.

Subject: Installing an MSI within an MSI (Cont.)
Posted by: Anonymous (not signed in)
Posted on: Tuesday, March 13, 2007 at 2:06 PM
Message: Since the last posting I revisited your book, and found that you had suggested some alternatives to working around the problem I initially posted. It sounds like the best approach to my problem is building a self-extracting executable. I image that approach to contain third party dependencies consisting of install package (.msi) files, self-extracting executables, and zip files, along with an overarching program that figures out what needs to be installed (launcher program). This program would sequentially install third party dependencies by kicking off an installed or unzipping an archive and then kick off the main application install packge (.msi). One question, you mention one program (I'll call it an extractor) that extracts all the files to a folder on the client and then starts the launcher program. Could the extractor and launcher not be the same program?

Subject: problem in setup project in visual studio.net
Posted by: Anonymous (not signed in)
Posted on: Tuesday, April 3, 2007 at 1:06 AM
Message: Dear sir,
I have problem in using setup project in visual studio.net when i creat database in server and after that make setup from it for using another client and copy of setup project with .net framework and install it to another client computer it is not working i do not know that what is problem it is give me error that is default setting of sqlserver does not alloww to remote connection if you send me the solution my big problem will be solved.

thank you sir

Subject: I express gratitude to the owner of a site. Good work.
Posted by: Anonymous (not signed in)
Posted on: Thursday, April 5, 2007 at 8:19 PM
Message: I express gratitude to the owner of a site. Good work.

Subject: With the best regards, Tom Hughes
Posted by: Anonymous (not signed in)
Posted on: Sunday, April 8, 2007 at 1:01 AM
Message: With the best regards, Tom Hughes

Subject: Thank for a good site
Posted by: Anonymous (not signed in)
Posted on: Sunday, April 8, 2007 at 11:10 PM
Message: Thank for a good site

Subject: Excellent informative site
Posted by: Anonymous (not signed in)
Posted on: Monday, April 9, 2007 at 5:06 PM
Message: Excellent informative site

Subject: prompting for reboot at the end of installation
Posted by: Anonymous (not signed in)
Posted on: Tuesday, April 10, 2007 at 1:49 PM
Message: Can I prompt for reboot using VS2005 at the end of the installation. I actually install a driver and need a reboot for the driver to be loaded.

Thanks.

Subject: Great
Posted by: Anonymous (not signed in)
Posted on: Tuesday, April 24, 2007 at 10:54 AM
Message: Very good article.

Thank you very much.

Subject: .MSI Name
Posted by: Anonymous (not signed in)
Posted on: Friday, May 18, 2007 at 3:15 PM
Message: Is there any way to know the name of the installer that called my custom action? I'm trying to make an application that logs installations versions and which takes the number of version from the .msi's name

Thanks

Sorry my poor english....

Subject: Change property value
Posted by: Sebastian (view profile)
Posted on: Friday, June 1, 2007 at 3:31 PM
Message: Is there any way to change the value of a property in compilation time? It means, I need that the author property of the installer can take the username of the logged user in windows. So the .msi file can has the author property with the name of the programmer logged in the machine that generated this msi.

thanks

Subject: Change property value
Posted by: Sebastian (view profile)
Posted on: Friday, June 1, 2007 at 3:36 PM
Message: Is there any way to change the value of a property in compilation time? It means, I need that the author property of the installer can take the username of the logged user in windows. So the .msi file can has the author property with the name of the programmer logged in the machine that generated this msi.

thanks

Subject: Installer class
Posted by: Anonymous (not signed in)
Posted on: Monday, June 11, 2007 at 9:32 AM
Message: Thank you for putting up this information and the clear way of presentation.

Subject: How to use VBScript to validate the serial no.key?
Posted by: Anonymous (not signed in)
Posted on: Wednesday, September 5, 2007 at 9:13 AM
Message: How to validate the Serial no.key in customer info.dialog box in msi?

Can we use VBscript instead of C++ dll?

Please reply.

Shyam

Subject: Alternative ways to create setup within Visual Studio
Posted by: Paul (view profile)
Posted on: Friday, September 14, 2007 at 5:28 PM
Message: If you use Visual Studio Setup and Deployment projects, you might already know that it is not very good for creating really smart setups we often need. I'd like to share two alternative ways to create installers within Visual Studio IDE:

+ Lexpa - Inno Setup integration for Visual Studio [http://www.lexpa.com]. Creates small and fast installers.

+ Votive - WiX toolset integration for Visual Studio [http://wix.sourceforge.net/votive.html]. Creates MSI-based installers.

Both add special project type to VS Add New Project dialog and allow you to create setup of any level of difficulty.

Subject: Can't find the code examples
Posted by: Anonymous (not signed in)
Posted on: Thursday, September 20, 2007 at 5:05 AM
Message: Hi,

Where can I find the link to download the code examples? I cannot find any link to the right of the title. Please assist me.

Thank you.

Subject: I would like to see the code samples too
Posted by: RandyStimpson (view profile)
Posted on: Thursday, September 27, 2007 at 11:40 PM
Message: Did the link get removed or what?

Subject: Self Exctraction Of Windows Installer and .dotnetfx while application deployment
Posted by: Raju (view profile)
Posted on: Saturday, September 29, 2007 at 4:09 AM
Message: I developed an appliaction using C#.Net 2.0. I can create setup for the appliaction alone. But I need the application should deployed at the client machine along with the required Windows Installer 3.0 and dotnetfx.exe as self extracting files so that user doesn't require much installation procedures.

Can any one help me in this regard.

Raju

Subject: Installation Kit
Posted by: Anonymous (not signed in)
Posted on: Friday, November 2, 2007 at 8:45 PM
Message: I bought the Visual Basic 6.0 Installation kit but due to the fact that I was moving from my old apartment to a new one, i misplaced the installation CD without notice and ever since, I have been trying to download the link over the internet but I was unsuccessful. Please who can help me in this problem.
Send the file or link to theanointedgodwin@yahoo.co.uk or unlimitedgodwin@googlemail.com

Subject: How to invoke the uninstall
Posted by: Ivan (not signed in)
Posted on: Friday, November 30, 2007 at 12:22 AM
Message: Hi, If I have a vbscript on a custom action that creates an application pool and an error occurs. Can the vbscript could make something to rollback the complete setup?

Subject: Anonymous Comments Disabled
Posted by: Sarah Grady (view profile)
Posted on: Wednesday, December 19, 2007 at 9:55 AM
Message: Due to a high volume of spam, anonymous comments have been disabled.

Subject: Custom Build
Posted by: fayssal (view profile)
Posted on: Tuesday, January 8, 2008 at 2:55 AM
Message: Hi,

I have set up a deployment project in Visual Studio 2005, and it works fine. Is there a way to specify which files/folders should be included in the installation at build time? I want to use the same setup project to build different MSI target files based on different conditions to be specified for the files to be included. Is that possible?

Subject: Missing Code Examples are referred to in the Article.
Posted by: charliearcuri (view profile)
Posted on: Monday, January 28, 2008 at 1:57 PM
Message: Thanks very much for the great article. I would like to download the code samples but there is no link as the article suggests:

"(You can download the code examples to go with this article using the link to the right of the title.)"

Either that reference to the code examples should be removed or a link should appear next to the title, "Visual Studio Setup - projects and custom actions," IMHO.

Subject: how to get file when install and uninstall?
Posted by: ducnm (view profile)
Posted on: Friday, April 25, 2008 at 4:18 AM
Message: When I try create custom action with C++. I want get all file name when Install phase and Uninstall but I cannot access. How to get file name will install before installed and uninstalled?

Subject: am i a retard or has the download link been removed????
Posted by: jointogetdownloads (view profile)
Posted on: Thursday, May 1, 2008 at 3:59 AM
Message: if so maybe u should do the right thing and update this part of the article.

"(You can download the code examples to go with this article using the link to the right of the title.)"


Subject: How add a c++ dll to Installer Class
Posted by: huzzy143 (view profile)
Posted on: Monday, June 16, 2008 at 1:56 AM
Message: hi,

I have bought a licensing solution from Interactive Studio Inc known as QLM which is mainly used for Licensing Solution.
[1] Now i need to add few lines of code which will accept a license code from user and pass this to a method of a .dll which the QLM has shipped. This .dll is internally calling a C++ DLL. When i try to run the code it gives an error as its not able to locate the C++ dll. When i try to add a reference its not able to do it as a C++ dll. When i manually add the C++ dll to bin folder it works great.
[2] Now i am creating a setup which will ask for License code and then take that code through the Setup User Interface and pass it to the Installer class that i have created so as to integrate it with QLM.
[3] Now as it requires this C++ dll its gives an error again.

Can anyone help as to how can i reference this C++ dll in my installer class which is internally being called by a C# .dll being shipped by QLM.

Subject: How add a c++ dll to Installer Class
Posted by: huzzy143 (view profile)
Posted on: Monday, June 16, 2008 at 9:16 AM
Message: hi,

I have bought a licensing solution from Interactive Studio Inc known as QLM which is mainly used for Licensing Solution.
[1] Now i need to add few lines of code which will accept a license code from user and pass this to a method of a .dll which the QLM has shipped. This .dll is internally calling a C++ DLL. When i try to run the code it gives an error as its not able to locate the C++ dll. When i try to add a reference its not able to do it as a C++ dll. When i manually add the C++ dll to bin folder it works great.
[2] Now i am creating a setup which will ask for License code and then take that code through the Setup User Interface and pass it to the Installer class that i have created so as to integrate it with QLM.
[3] Now as it requires this C++ dll its gives an error again.

Can anyone help as to how can i reference this C++ dll in my installer class which is internally being called by a C# .dll being shipped by QLM.

Subject: Two Project OutPut Custom install action
Posted by: roadrush (view profile)
Posted on: Saturday, July 5, 2008 at 8:05 PM
Message: Hai,

How to use the installer class for deploying the two projects.During the installation process , set up and deployment will ask the user

1) do u like to install project1 output
2) do u like to install project2 output
3) do u like to install both project output

I know how to use the installer class to deploy all the projects(project1,project2) but i don't know how to control the user selection during the installation.If suppose the user selects the project1 then i have to deploy only the project1 exe files.If some one have any idea help me with this issue


Subject: Two Project OutPut Custom install action
Posted by: roadrush (view profile)
Posted on: Saturday, July 5, 2008 at 8:39 PM
Message: Hai,

How to use the installer class for deploying the two projects.During the installation process , set up and deployment will ask the user

1) do u like to install project1 output
2) do u like to install project2 output
3) do u like to install both project output

I know how to use the installer class to deploy all the projects(project1,project2) but i don't know how to control the user selection during the installation.If suppose the user selects the project1 then i have to deploy only the project1 exe files.If some one have any idea help me with this issue


Subject: Two Project OutPut Custom install action
Posted by: roadrush (view profile)
Posted on: Sunday, July 6, 2008 at 4:39 AM
Message: Hai,

How to use the installer class for deploying the two projects.During the installation process , set up and deployment will ask the user

1) do u like to install project1 output
2) do u like to install project2 output
3) do u like to install both project output

I know how to use the installer class to deploy all the projects(project1,project2) but i don't know how to control the user selection during the installation.If suppose the user selects the project1 then i have to deploy only the project1 exe files.If some one have any idea help me with this issue


Subject: TARGETDIR tag not recognized in VS 2005!!!
Posted by: miguelguzman (view profile)
Posted on: Sunday, July 6, 2008 at 11:56 AM
Message: Does anybody know what is the updated tag name for the installation directory the user chooses during the application installation? I've searched everywher with no luck :(

I need to setup a registry key with the installation path.

Thanks!!!
miguelguzman

Subject: Uninstaller
Posted by: haterclay (view profile)
Posted on: Monday, August 4, 2008 at 3:54 AM
Message: Hi

Ur article is really helpful to me. thank aloz.

There is one thing i still don't know.

How can i crate a uninstaller? I would like to place in Program menu where the application shortcut are installed.

Thank a loz
Hater

Subject: Is Phil's other blog defunct?
Posted by: AbacusData (view profile)
Posted on: Thursday, January 1, 2009 at 2:58 AM
Message: On 14 Dec 2008 I posted a query at Phil's other blog, http://www.simple-talk.com/dotnet/visual-studio/getting-started-with-setup-projects/ , and noticed that there had been no responses from Phil for more than a year.

Does he still look at it?

Subject: Query on an installation issue.
Posted by: buzzsuresh (view profile)
Posted on: Wednesday, April 29, 2009 at 3:06 PM
Message: Hi Phil,
Your information on the installer stuff looks great, which impressed me to join this group to gain more knowledge.

I would like to get your advice on an issue which i am facing.
I had built an msi which internally installs an driver later followed by an policy setting.
Driver exe launches perfectly fine but the installation and prompt of that gets launched at the back of the msi installation. By this it actually looks like the msi installation is hanging. I would like to bring the driver installation and its prompt to front. Can you give me some suggestion or shed some light on how to do that.
Your info on this would be lot helpful for me.

thanks.

Subject: Regarding the vs projects executing the custom actions of the previous version
Posted by: andyshader (view profile)
Posted on: Thursday, June 18, 2009 at 3:44 PM
Message: Another way to solve this problem is to create a custom actions stongly named assembly (sign the custom actions library project). Also make sure to increase the assembly version and assembly file version for the custom actions with each new version update (increasing the assembly version whenever you increase it in the setup project).

-- Andy

Subject: setup project custom dlls(.net dependent or not) always require .net framework?
Posted by: bhatia_amit (view profile)
Posted on: Tuesday, July 21, 2009 at 3:21 AM
Message: I have made a custom dll for my setup project. My dll is very simple, registering few services, not CLR or any 3rd party lib dependent. Have statically linked with msi.lib only.

I have removed the .net and windows installer prerequisite requirements from the setup project. My setup fails on machines not having .net framework..?

As I have not having any .net dependent code, what should be the solution to this. I don;t want user to download framework first for installation.

Your responses will really be appreciated.

Regards
Amit ( amit.bhatia.1984@gmail.com)

Subject: How to integrate two different setups into one?
Posted by: manishjain (view profile)
Posted on: Friday, February 5, 2010 at 3:07 AM
Message: I have one setup which installs the windows service and the another one installs Web service.I need to have one setup providing an option to the user to select the service which he wants to install.

Subject: Re: How to integrate two different setups into one?
Posted by: pranka (view profile)
Posted on: Monday, April 5, 2010 at 10:37 AM
Message: If you are doing two install in a row, the best would be to save the required data from first install to a registry and use it after second install.

Subject: Windows Installer Rollback install directory files cleanup problem
Posted by: usmanbinasif (view profile)
Posted on: Wednesday, June 9, 2010 at 8:02 AM
Message: Hello,

I am facing problem in Windows Installer Rollback functionality using C#.net 2.0. I have created an installer class and it launches custom action [installer type] to create database and take user inputs for application settings, If user wants to rollback I use InstallerException with custom message, but if I do so then in the install directory some temp files and CreateDatabase.InstallState [CreateDatabase is the name of my application which is launched through custom action] file are not removed and these are supposed to be removed.

In the mentioned scenario I want to rollback in such a way that system should be restored to its initial state as it is requirement for Windows 7 logo certification. Any help in this regard will be highly appreciated.

Regards,
Usman Javed

Subject: execute a database create script during deployment
Posted by: oghenez (view profile)
Posted on: Thursday, April 28, 2011 at 7:44 AM
Message: how do i execute a database create script using custom actions during deployment of my application, the database i create script has views, stored procedure etc.
thanks

Subject: Install and Configure IIS using Web Setup
Posted by: Sherin (view profile)
Posted on: Wednesday, July 6, 2011 at 3:17 AM
Message: Hi

How can i install both .net frame work and iis (including configure iis with .net frame work)
using WebSetup in visual studio 2005?

Thanks

Subject: Calling .exe file in custom action (install)
Posted by: chandrakant (view profile)
Posted on: Monday, July 25, 2011 at 6:12 AM
Message: Hi
I have call one .exe file in custom install action.
The functionality of .exe file is read the Log.ini file.
when i launch setup it does not read that log.ini from installed directory.
how can i solve that problem so i read that file.

Thanks in advanced

Please help me.argent



Subject: Question about IVR development
Posted by: Giovanni68 (view profile)
Posted on: Tuesday, January 22, 2013 at 3:32 AM
Message: Good Day,

I work for a small company and my manager told me to look for an SDK for our purposes. There are lots of SDKs on the market and finally I decided on one which is called Ozeki VoIP SIP SDK. I need more information on IVR systems and I use this page: http://www.voip-sip-sdk.com/p_410-voip-multichannel-ivr-server-voip.html. My boss requires a summary and I thought it would be nice to add some external feedbacks about this SDK. This is why I ask you to give me some personal feedbacks if have any.

Thanks for the information.

Subject: I need your help to run my file I get this window xxx.cpp
Posted by: teecweb (view profile)
Posted on: Friday, February 8, 2013 at 10:06 AM
Message: Hi,

thanks for the reply..xxxx.cpp file when debugging I came this screen:



--------------------------------------------------
No debugging information
--------------------------------------------------
The xxxx.EXE debugging information can not be found or does not match. Symbols not loaded.

Do you want to continue debugging?


yes or not

--------------------------------------------------------------------------------------

Please I need your help thanks for the reply.

Subject: I need your help to run my file I get this window xxx.cpp
Posted by: teecweb (view profile)
Posted on: Friday, February 8, 2013 at 12:04 PM
Message: Hi,

thanks for the reply..xxxx.cpp file when debugging I came this screen:



--------------------------------------------------
No debugging information
--------------------------------------------------
The xxxx.EXE debugging information can not be found or does not match. Symbols not loaded.

Do you want to continue debugging?


yes or not

--------------------------------------------------------------------------------------

Please I need your help thanks for the reply.

Subject: Custom Installer in .Net showing exe window behind installer in vista
Posted by: Sapana (view profile)
Posted on: Monday, April 15, 2013 at 12:19 AM
Message: I have an application that is being deployed via a Visual Studio Setup Project, however, I had to create some custom action Install exe which is used to install drivers when application is going to install.

Its working fine on Xp but on Vista and window 7 the window of the exe hinding behind the main application installation window.how to bring front????



Plz Help me

Subject: Prevent uninstall when it is running
Posted by: Paul Sandip (view profile)
Posted on: Monday, October 14, 2013 at 1:57 AM
Message: I want to prevent uninstall a program when it is running.I want to do it by custom action in visual studio 2010 setup and deployment.

Subject: execute a custom action before uninstall starts
Posted by: ananth46.reddy (view profile)
Posted on: Tuesday, January 27, 2015 at 5:41 AM
Message: Hi,
I would like to know, if there is any way to execute a custom action before uninstallation of an already installed application starts in visual studio 2010

Please help me

Thanks in advance

 

Top Rated

Building a Customised ALM Platform with TFS and VSO
 The latest versions of Team Foundation Server are not only sophisticated, but extensible. Continue... Read more...

Rethinking the Practicalities of Recursion
 We all love recursion right up to the point of actually using it in production code. Why? Recursion... Read more...

Acceptance Testing with FitNesse: Multiplicities and Comparisons
 FitNesse is one of the most popular tools for unit testing since it is designed with a Wiki-style... Read more...

Acceptance Testing with FitNesse: Documentation and Infrastructure
 FitNesse is a popular general-purpose wiki-based framework for writing acceptance tests for software... Read more...

Prototyping Desktop Deblector
 Deblector is an open-source debugging add-in for .NET Reflector; the Reflector team investigated... Read more...

Most Viewed

A Complete URL Rewriting Solution for ASP.NET 2.0
 Ever wondered whether it's possible to create neater URLS, free of bulky Query String parameters?... Read more...

Visual Studio Setup - projects and custom actions
 This article describes the kinds of custom actions that can be used in your Visual Studio setup project. Read more...

.NET Application Architecture: the Data Access Layer
 Find out how to design a robust data access layer for your .NET applications. Read more...

Calling Cross Domain Web Services in AJAX
 The latest craze for mashups involves making cross-domain calls to Web Services from APIs made publicly... Read more...

10 Reasons Why Visual Basic is Better Than C#
 After having converted a whole lot of training materials based on VB.NET into C#, Andy ‘Wise Owl’ Brown... Read more...

Why Join

Over 400,000 Microsoft professionals subscribe to the Simple-Talk technical journal. Join today, it's fast, simple, free and secure.