本文整理汇总了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();
}
示例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 + "'");
}