当前位置: 首页>>代码示例>>C#>>正文


C# IVsSolution.GetProjectOfUniqueName方法代码示例

本文整理汇总了C#中IVsSolution.GetProjectOfUniqueName方法的典型用法代码示例。如果您正苦于以下问题:C# IVsSolution.GetProjectOfUniqueName方法的具体用法?C# IVsSolution.GetProjectOfUniqueName怎么用?C# IVsSolution.GetProjectOfUniqueName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVsSolution的用法示例。


在下文中一共展示了IVsSolution.GetProjectOfUniqueName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetProjectsFromSolution

 public static Project[] GetProjectsFromSolution(IVsSolution solution, string pUniqueName, string projectKind)
 {
     List<Project> projects = new List<Project>();
     if (solution == null)
     {
         return projects.ToArray();
     }
     IEnumHierarchies ppEnum;
     Guid tempGuid = Guid.Empty;
     solution.GetProjectEnum((uint)Microsoft.VisualStudio.Shell.Interop.__VSENUMPROJFLAGS.EPF_ALLPROJECTS, ref tempGuid, out ppEnum);
     if (ppEnum != null)
     {
         uint actualResult = 0;
         IVsHierarchy hierarchy;
         solution.GetProjectOfUniqueName(pUniqueName, out hierarchy);
         IVsHierarchy[] nodes = new IVsHierarchy[1];
         nodes[0] = hierarchy;
         while (0 == ppEnum.Next(1, nodes, out actualResult))
         {
             Object obj;
             nodes[0].GetProperty((uint)Microsoft.VisualStudio.VSConstants.VSITEMID_ROOT, (int)Microsoft.VisualStudio.Shell.Interop.__VSHPROPID.VSHPROPID_ExtObject, out obj);
             Project project = obj as Project;
             if (project != null)
             {
                 if (string.IsNullOrEmpty(projectKind))
                 {
                     projects.Add(project);
                 }
                 else if (projectKind.Equals(project.Kind, StringComparison.InvariantCultureIgnoreCase))
                 {
                     projects.Add(project);
                 }
             }
         }
     }
     return projects.ToArray();
 }
开发者ID:Exclr8,项目名称:CloudCore,代码行数:37,代码来源:DTEWrapper.cs

示例2: SetProjectPropertyGroupValue

        internal static void SetProjectPropertyGroupValue(IVsSolution solution, DTE service, string propertyName, string newValue)
        {
            Project project = GetSelectedProject(service);
            string uniqueName = project.UniqueName;
            IVsHierarchy hierarchy;
            solution.GetProjectOfUniqueName(uniqueName, out hierarchy);

            IVsBuildPropertyStorage buildPropertyStorage = hierarchy as IVsBuildPropertyStorage;
            int hr = buildPropertyStorage.SetPropertyValue(propertyName, null, (uint)_PersistStorageType.PST_PROJECT_FILE, newValue);

            LogMessage(service, project, "Updating project property '" + propertyName + "' with value '" + newValue + "'");
        }
开发者ID:manuel11g,项目名称:SharePoint-Software-Factory,代码行数:12,代码来源:Helpers.cs


注:本文中的IVsSolution.GetProjectOfUniqueName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。