RunInstallerAttribute Class
Collapse the table of content
Expand the table of content

RunInstallerAttribute Class

Specifies whether the Visual Studio Custom Action Installer or the Installer Tool (Installutil.exe) should be invoked when the assembly is installed.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

public class RunInstallerAttribute : Attribute

If a class that inherits from Installer is marked with the RunInstallerAttribute set to true, Visual Studio's Custom Action Installer or the InstallUtil.exe will be invoked when the assembly is installed. Members marked with the RunInstallerAttribute set to false will not invoke an installer. The default is false.


When you mark a property with the RunInstallerAttribute set to true, the value of this attribute is set to the constant member Yes. For a property marked with the RunInstallerAttribute set to false, the value is No. Therefore, when you want to check the value of this attribute in your code, you must specify the attribute as RunInstallerAttribute.Yes or RunInstallerAttribute.No.

For more information, see Attributes Overview and Extending Metadata Using Attributes.

The following example specifies that the installer should be run for MyProjectInstaller.

 public class MyProjectInstaller : Installer {
    // Insert code here.

The next example creates an instance of MyProjectInstaller. Then it gets the attributes for the class, extracts the RunInstallerAttribute, and prints whether to run the installer.

public static int Main() {
    // Creates a new installer.
    MyProjectInstaller myNewProjectInstaller = new MyProjectInstaller();

    // Gets the attributes for the collection.
    AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewProjectInstaller);

    /* Prints whether to run the installer by retrieving the 
     * RunInstallerAttribute from the AttributeCollection. */
    RunInstallerAttribute myAttribute = 
    Console.WriteLine("Run the installer? " + myAttribute.RunInstaller.ToString());

    return 0;


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Community Additions

© 2016 Microsoft