SharePoint 프로젝트 시스템 형식과 기타 Visual Studio 프로젝트 형식 간의 변환

SharePoint 프로젝트 시스템에 개체가 있는데 Visual Studio 자동화 개체 모델이나 통합 개체 모델의 해당 개체 기능을 사용하려는 경우나 그 반대의 경우가 있을 수 있습니다. 이러한 경우 SharePoint 프로젝트 서비스의 Convert<TInput, TOutput> 메서드를 사용하여 개체를 다른 개체 모델로 변환할 수 있습니다.

예를 들어 ISharePointProject 개체가 있는데 EnvDTE.Project 또는 Microsoft.VisualStudio.Shell.Interop.IVsProject 개체에서만 사용할 수 있는 메서드를 사용하려고 할 수 있습니다. 이 경우 Convert<TInput, TOutput> 메서드를 사용하여 ISharePointProjectEnvDTE.Project 또는 Microsoft.VisualStudio.Shell.Interop.IVsProject로 변환할 수 있습니다.

Visual Studio 자동화 개체 모델 및 Visual Studio 통합 개체 모델에 대한 자세한 내용은 SharePoint 도구 확장의 프로그래밍 모델 개요를 참조하십시오.

변환 형식

다음 표에서는 이 메서드를 통해 SharePoint 프로젝트 시스템과 기타 Visual Studio 개체 모델 간에 변환할 수 있는 형식을 보여 줍니다.

SharePoint 프로젝트 시스템 형식

자동화 및 통합 개체 모델의 해당 형식

ISharePointProject

EnvDTE.Project

또는

프로젝트에 대한 내부 COM 개체에서 구현되는 Visual Studio 통합 개체 모델의 모든 인터페이스. 이러한 인터페이스에는 Microsoft.VisualStudio.Shell.Interop.IVsHierarchy, Microsoft.VisualStudio.Shell.Interop.IVsProject(또는 파생 인터페이스) 및 Microsoft.VisualStudio.Shell.Interop.IVsBuildPropertyStorage가 포함됩니다. 프로젝트에서 구현되는 주요 인터페이스의 목록은 Project Model Core Components를 참조하십시오.

IMappedFolder

ISharePointProjectItem

ISharePointProjectItemFile

ISharePointProjectFeature

ISharePointProjectFeatureResourceFile

ISharePointProjectPackage

EnvDTE.ProjectItem

또는

Microsoft.VisualStudio.Shell.Interop.IVsHierarchy에서 해당 항목을 포함하는 프로젝트 멤버를 식별하는 UInt32 값(VSITEMID라고도 함). 이 값은 일부 Microsoft.VisualStudio.Shell.Interop.IVsHierarchy 메서드의 itemid 매개 변수에 전달할 수 있습니다.

예제

다음 코드 예제에서는 Convert<TInput, TOutput> 메서드를 사용하여 ISharePointProject 개체를 EnvDTE.Project로 변환하는 방법을 보여 줍니다.

Private Sub projectService_ProjectAdded(ByVal sender As Object, _
    ByVal e As Microsoft.VisualStudio.SharePoint.SharePointProjectEventArgs)

    Dim dteProject As EnvDTE.Project = e.Project.ProjectService.Convert( _
        Of Microsoft.VisualStudio.SharePoint.ISharePointProject, EnvDTE.Project)(e.Project)
    If dteProject IsNot Nothing Then
        ' Use the Visual Studio automation object model to add a folder to the project.
        dteProject.ProjectItems.AddFolder("Data")
    End If
End Sub
void projectService_ProjectAdded(object sender, Microsoft.VisualStudio.SharePoint.SharePointProjectEventArgs e)
{
    EnvDTE.Project dteProject = e.Project.ProjectService.Convert<
        Microsoft.VisualStudio.SharePoint.ISharePointProject, EnvDTE.Project>(e.Project);

    if (dteProject != null)
    {
        // Use the Visual Studio automation object model to add a folder to the project.
        dteProject.ProjectItems.AddFolder("Data");
    }
}

이 예제에는 다음 사항이 필요합니다.

참고 항목

개념

SharePoint 프로젝트 서비스 사용

SharePoint 도구 확장의 프로그래밍 모델 개요

기타 리소스

방법: SharePoint 프로젝트 서비스 검색