RunInstallerAttribute Class
Specifies whether the Visual Studio Custom Action Installer or the Installer Tool (Installutil.exe) should be invoked when the assembly is installed.
Assembly: System (in System.dll)
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.
Note: |
|---|
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.
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 Shared Function Main() As Integer ' Creates a new installer. Dim myNewProjectInstaller As New MyProjectInstaller() ' Gets the attributes for the collection. Dim attributes As AttributeCollection = TypeDescriptor.GetAttributes(myNewProjectInstaller) ' Prints whether to run the installer by retrieving the ' RunInstallerAttribute from the AttributeCollection. Dim myAttribute As RunInstallerAttribute = _ CType(attributes(GetType(RunInstallerAttribute)), RunInstallerAttribute) Console.WriteLine(("Run the installer? " & myAttribute.RunInstaller.ToString())) Return 0 End Function 'Main
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.
Note: