IAddInPostDeploymentAction.Execute 메서드

배포 후 작업을 실행하며, 이 작업을 통해 추가 설치 단계를 ClickOnce 설치 관리자의 마지막 단계로 수행할 수 있습니다.

네임스페이스:  Microsoft.VisualStudio.Tools.Applications.Deployment
어셈블리:  Microsoft.VisualStudio.Tools.Applications.Runtime(Microsoft.VisualStudio.Tools.Applications.Runtime.dll)

구문

‘선언
Sub Execute ( _
    args As AddInPostDeploymentActionArgs _
)
void Execute(
    AddInPostDeploymentActionArgs args
)

매개 변수

예제

Sub Execute(ByVal args As AddInPostDeploymentActionArgs) Implements IAddInPostDeploymentAction.Execute
    Dim dataDirectory As String = "Data\ExcelWorkbook.xlsx"
    Dim file As String = "ExcelWorkbook.xlsx"
    Dim sourcePath As String = args.AddInPath
    Dim deploymentManifestUri As Uri = args.ManifestLocation
    Dim destPath As String = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
    Dim sourceFile As String = System.IO.Path.Combine(sourcePath, dataDirectory)
    Dim destFile As String = System.IO.Path.Combine(destPath, file)

    Select Case args.InstallationStatus
        Case AddInInstallationStatus.InitialInstall, AddInInstallationStatus.Update
            System.IO.File.Copy(sourceFile, destFile)
            ServerDocument.RemoveCustomization(destFile)
            ServerDocument.AddCustomization(destFile, deploymentManifestUri)
            Exit Select
        Case AddInInstallationStatus.Uninstall
            If System.IO.File.Exists(destFile) Then
                System.IO.File.Delete(destFile)
            End If
            Exit Select
    End Select
End Sub
public void Execute(AddInPostDeploymentActionArgs args) 
{
    string dataDirectory = @"Data\ExcelWorkbook.xlsx";
    string file = @"ExcelWorkbook.xlsx";
    string sourcePath = args.AddInPath;
    Uri deploymentManifestUri = args.ManifestLocation;
    string destPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
    string sourceFile = System.IO.Path.Combine(sourcePath, dataDirectory);
    string destFile = System.IO.Path.Combine(destPath, file);

    switch (args.InstallationStatus)
    {
        case AddInInstallationStatus.InitialInstall:
        case AddInInstallationStatus.Update:
            File.Copy(sourceFile, destFile);
            ServerDocument.RemoveCustomization(destFile);
            ServerDocument.AddCustomization(destFile, deploymentManifestUri);
            break;
        case AddInInstallationStatus.Uninstall:
            if (File.Exists(destFile))
            {
                File.Delete(destFile);
            }
            break;
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

IAddInPostDeploymentAction 인터페이스

Microsoft.VisualStudio.Tools.Applications.Deployment 네임스페이스

AddInPostDeploymentActionArgs