RunInstallerAttribute Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Especifica se o Visual Studio Custom Action Installer ou o Installutil.exe (Ferramenta de Instalação) devem ser invocados quando o conjunto é instalado.
public ref class RunInstallerAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public class RunInstallerAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type RunInstallerAttribute = class
inherit Attribute
Public Class RunInstallerAttribute
Inherits Attribute
- Herança
- Atributos
Exemplos
O exemplo seguinte especifica que o instalador deve ser executado para MyProjectInstaller.
[RunInstallerAttribute(true)]
ref class MyProjectInstaller: public Installer{
// Insert code here.
};
[RunInstallerAttribute(true)]
public class MyProjectInstaller : Installer {
// Insert code here.
}
<RunInstallerAttribute(True)> _
Public Class MyProjectInstaller
Inherits Installer
' Insert code here.
End Class
O exemplo seguinte cria uma instância de MyProjectInstaller. Depois obtém os atributos da classe, extrai o RunInstallerAttribute, e imprime se deve executar o instalador.
int main()
{
// Creates a new installer.
MyProjectInstaller^ myNewProjectInstaller = gcnew 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 = dynamic_cast<RunInstallerAttribute^>(attributes[ RunInstallerAttribute::typeid ]);
Console::WriteLine( "Run the installer? {0}", myAttribute->RunInstaller );
return 0;
}
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 =
(RunInstallerAttribute)attributes[typeof(RunInstallerAttribute)];
Console.WriteLine("Run the installer? " + myAttribute.RunInstaller.ToString());
return 0;
}
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
Observações
Se uma classe que herda de Installer estiver marcada com o RunInstallerAttribute definido para true, o Instalador de Ações Personalizadas da Visual Studio ou o InstallUtil.exe será invocado quando o conjunto for instalado. Os membros marcados com o RunInstallerAttribute conjunto para false não invocarão um instalador. A predefinição é true.
Note
Quando se marca uma propriedade com o RunInstallerAttribute conjunto em true, o valor deste atributo é definido para o elemento Yesconstante . Para uma propriedade marcada com o RunInstallerAttribute conjunto de , falseo valor é No. Portanto, quando quiser verificar o valor deste atributo no seu código, deve especificar o atributo como RunInstallerAttribute.Yes ou RunInstallerAttribute.No.
Para obter mais informações, consulte Atributos.
Construtores
| Name | Description |
|---|---|
| RunInstallerAttribute(Boolean) |
Inicializa uma nova instância da RunInstallerAttribute classe. |
Campos
| Name | Description |
|---|---|
| Default |
Especifica a visibilidade padrão, que é No. Este |
| No |
Especifica que o Visual Studio Instalador de Ações Personalizadas ou o Installutil.exe (Ferramenta de Instalação) não devem ser invocados quando o conjunto é instalado. Este |
| Yes |
Especifica que o Visual Studio Instalador de Ações Personalizadas ou o Installutil.exe (Ferramenta de Instalação) devem ser invocados quando o conjunto for instalado. Este |
Propriedades
| Name | Description |
|---|---|
| RunInstaller |
Recebe um valor que indica se um instalador deve ser invocado durante a instalação de um conjunto. |
| TypeId |
Quando implementado numa classe derivada, obtém um identificador único para esta Attribute. (Herdado de Attribute) |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Determina se o valor do especificado RunInstallerAttribute é equivalente à corrente RunInstallerAttribute. |
| GetHashCode() |
Gera um código de hash para o atual RunInstallerAttribute. |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| IsDefaultAttribute() |
Determina se este atributo é o padrão. |
| Match(Object) |
Quando sobrescrito numa classe derivada, devolve um valor que indica se esta instância é igual a um objeto especificado. (Herdado de Attribute) |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |
Implementações de Interface Explícita
| Name | Description |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Mapeia um conjunto de nomes para um conjunto correspondente de identificadores de despacho. (Herdado de Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
Recupera a informação de tipo de um objeto, que pode ser usada para obter a informação de tipo para uma interface. (Herdado de Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
Recupera o número de interfaces de informações de tipo que um objeto fornece (0 ou 1). (Herdado de Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Proporciona acesso a propriedades e métodos expostos por um objeto. (Herdado de Attribute) |