UninstallAction 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
제거 중에 설치 관리자가 수행할 작업을 지정합니다.
public enum class UninstallAction
public enum UninstallAction
type UninstallAction =
Public Enum UninstallAction
- 상속
필드
NoAction | 1 | 설치 관리자가 만든 리소스를 그대로 둡니다. |
Remove | 0 | 설치 관리자가 만든 리소스를 제거합니다. |
예제
다음 예제에서는 상속 되는 사용자 지정 제거는 Installer 클래스입니다. 재정의 된 Uninstall 함수는 UninstallAction 열거형 사용자 입력에 따라 설정 됩니다. 입력 "n" 인 경우 사용자 지정 설치 제거 관리자는 리소스는 사용자가 입력 한 이벤트 로그에 작업을 적용 되지 않습니다. 그렇지 않으면 이벤트 로그에서 리소스를 제거 합니다.
#using <System.dll>
#using <System.Configuration.Install.dll>
using namespace System;
using namespace System::Diagnostics;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Configuration::Install;
[RunInstaller(true)]
ref class MyUninstallActionClass: public Installer
{
private:
EventLogInstaller^ myInstaller;
public:
MyUninstallActionClass()
{
myInstaller = gcnew EventLogInstaller;
}
// Override the 'Install' method.
virtual void Install( IDictionary^ savedState ) override
{
Console::Write( "Enter a new log to create (eg: MyLog): " );
myInstaller->Log = Console::ReadLine();
Console::Write( "Enter a source for log (eg: MySource): " );
myInstaller->Source = Console::ReadLine();
Installers->Add( myInstaller );
Installer::Install( savedState );
}
// Override the 'Commit' method.
virtual void Commit( IDictionary^ savedState ) override
{
Installer::Commit( savedState );
}
// Override the 'Rollback' method.
virtual void Rollback( IDictionary^ savedState ) override
{
Installer::Rollback( savedState );
}
virtual void Uninstall( IDictionary^ savedState ) override
{
Console::Write( "Enter a source from log to uninstall(eg: MySource): " );
myInstaller->Source = Console::ReadLine();
Console::Write( "Do you want to uninstall, press 'y' for 'YES' and 'n' for 'NO':" );
String^ myUninstall = Console::ReadLine();
if ( myUninstall->Equals( "n" ) )
{
// No action to be taken on the resource in the event log.
myInstaller->UninstallAction = UninstallAction::NoAction;
}
else
{
// Remove the resource from the event log.
myInstaller->UninstallAction = UninstallAction::Remove;
}
Installers->Add( myInstaller );
Installer::Uninstall( savedState );
}
};
int main()
{
Console::WriteLine( "Syntax for install: installutil.exe UninstallAction_NoAction_Remove_3.exe " );
Console::WriteLine( "Syntax for uninstall: installutil.exe /u UninstallAction_NoAction_Remove_3.exe " );
}
using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
[RunInstaller(true)]
public class MyUninstallActionClass : Installer
{
EventLogInstaller myInstaller = new EventLogInstaller();
// Override the 'Install' method.
public override void Install(IDictionary savedState)
{
Console.Write("Enter a new log to create (eg: MyLog ): ");
myInstaller.Log = Console.ReadLine();
Console.Write("Enter a source for log (eg: MySource ): ");
myInstaller.Source = Console.ReadLine();
Installers.Add( myInstaller );
base.Install(savedState);
}
// Override the 'Commit' method.
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
}
// Override the 'Rollback' method.
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
public override void Uninstall(IDictionary savedState)
{
Console.Write("Enter a source from log to uninstall(eg: MySource ): ");
myInstaller.Source = Console.ReadLine();
Console.Write("Do you want to uninstall, press 'y' for 'YES' and 'n' for 'NO':");
string myUninstall = Console.ReadLine();
if( myUninstall == "n" )
{
// No action to be taken on the resource in the event log.
myInstaller.UninstallAction = System.Configuration.Install.UninstallAction.NoAction;
}
else
{
// Remove the resource from the event log.
myInstaller.UninstallAction = System.Configuration.Install.UninstallAction.Remove;
}
Installers.Add( myInstaller );
base.Uninstall(savedState);
}
public static void Main()
{
Console.WriteLine("Syntax for install: installutil.exe UninstallAction_NoAction_Remove_3.exe ");
Console.WriteLine("Syntax for uninstall: installutil.exe /u "
+"UninstallAction_NoAction_Remove_3.exe ");
}
}
Imports System.Diagnostics
Imports System.Collections
Imports System.ComponentModel
Imports System.Configuration.Install
<RunInstaller(True)> _
Public Class MyUninstallActionClass
Inherits Installer
Private myInstaller As New EventLogInstaller()
' Override the 'Install' method.
Public Overrides Sub Install(savedState As IDictionary)
Console.Write("Enter a new log to create (eg: MyLog ): ")
myInstaller.Log = Console.ReadLine()
Console.Write("Enter a source for log (eg: MySource ): ")
myInstaller.Source = Console.ReadLine()
Installers.Add(myInstaller)
MyBase.Install(savedState)
End Sub
' Override the 'Commit' method.
Public Overrides Sub Commit(savedState As IDictionary)
MyBase.Commit(savedState)
End Sub
' Override the 'Rollback' method.
Public Overrides Sub Rollback(savedState As IDictionary)
MyBase.Rollback(savedState)
End Sub
Public Overrides Sub Uninstall(savedState As IDictionary)
Console.Write("Enter a source from log to uninstall(eg: MySource ): ")
myInstaller.Source = Console.ReadLine()
Console.Write("Do you want to uninstall, press 'y' for 'YES' and 'n' for 'NO':")
Dim myUninstall As String = Console.ReadLine()
If myUninstall = "n" Then
' No action to be taken on the resource in the event log.
myInstaller.UninstallAction = System.Configuration.Install.UninstallAction.NoAction
Else
' Remove the resource from the event log.
myInstaller.UninstallAction = System.Configuration.Install.UninstallAction.Remove
End If
Installers.Add(myInstaller)
MyBase.Uninstall(savedState)
End Sub
Public Shared Sub Main()
Console.WriteLine("Syntax for install: installutil.exe "+ _
"UninstallAction_NoAction_Remove_3.exe ")
Console.WriteLine("Syntax for uninstall: installutil.exe /u " + _
"UninstallAction_NoAction_Remove_3.exe ")
End Sub
End Class
적용 대상
추가 정보
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET