ServerDocument.Close 메서드
ServerDocument 개체를 닫습니다.
네임스페이스: Microsoft.VisualStudio.Tools.Applications
어셈블리: Microsoft.VisualStudio.Tools.Applications.ServerDocument(Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll)
구문
‘선언
Public Sub Close
public void Close()
설명
이 메서드를 호출하여 모든 리소스를 해제하고 ServerDocument를 닫을 수 있습니다.
예제
다음 코드 예제에서는 새 ServerDocument를 만들고, 배포 매니페스트의 URL을 표시한 다음, Close 메서드를 사용하여 ServerDocument를 닫습니다.
이 예제에는 다음 사항이 필요합니다.
콘솔 응용 프로그램 프로젝트 또는 다른 비 Office 프로젝트입니다.
다음 어셈블리에 대한 참조:
Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll 및 Microsoft.VisualStudio.Tools.Applications.Runtime.dll(.NET Framework 4 또는 .NET Framework 4.5를 대상으로 하는 프로젝트의 경우)
또는
Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0.dll 및 Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll(.NET Framework 3.5를 대상으로 하는 프로젝트의 경우)
코드 파일 상단에 있는 Microsoft.VisualStudio.Tools.Applications 및 Microsoft.VisualStudio.Tools.Applications.Runtime 네임스페이스에 대해 Imports(Visual Basic의 경우) 또는 using(C#의 경우) 문.
Private Sub CreateServerDocumentFromPath(ByVal documentPath As String)
Dim runtimeVersion As Integer = 0
Dim serverDocument1 As ServerDocument = Nothing
Try
runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath)
If runtimeVersion = 3 Then
serverDocument1 = New ServerDocument(documentPath)
MessageBox.Show("The URL of the deployment manifest is: " & vbLf & _
serverDocument1.DeploymentManifestUrl.ToString())
End If
Catch ex As System.IO.FileNotFoundException
System.Windows.Forms.MessageBox.Show("The specified document does not exist.")
Catch ex As UnknownCustomizationFileException
System.Windows.Forms.MessageBox.Show("The specified document has a file " & _
"extension that is not supported by Visual Studio Tools for Office.")
Finally
If Not (serverDocument1 Is Nothing) Then
serverDocument1.Close()
End If
End Try
End Sub
private void CreateServerDocumentFromPath(string documentPath)
{
int runtimeVersion = 0;
ServerDocument serverDocument1 = null;
try
{
runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath);
if (runtimeVersion == 3)
{
serverDocument1 = new ServerDocument(documentPath);
MessageBox.Show("The URL of the deployment manifest is: \n" +
serverDocument1.DeploymentManifestUrl.ToString());
}
}
catch (System.IO.FileNotFoundException)
{
System.Windows.Forms.MessageBox.Show("The specified document does not exist.");
}
catch (UnknownCustomizationFileException)
{
System.Windows.Forms.MessageBox.Show("The specified document has a file " +
"extension that is not supported by Visual Studio Tools for Office.");
}
finally
{
if (serverDocument1 != null)
serverDocument1.Close();
}
}
.NET Framework 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.