本文整理汇总了C#中IVsSolution.CloseSolutionElement方法的典型用法代码示例。如果您正苦于以下问题:C# IVsSolution.CloseSolutionElement方法的具体用法?C# IVsSolution.CloseSolutionElement怎么用?C# IVsSolution.CloseSolutionElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsSolution
的用法示例。
在下文中一共展示了IVsSolution.CloseSolutionElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunFinished
public void RunFinished()
{
sln = ((IVsSolution)Package.GetGlobalService(typeof(SVsSolution)));
ServiceProvider serviceProvider = new ServiceProvider(dte as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);
string projectGuid = null;
using (XmlReader projectReader = XmlReader.Create(fileName))
{
projectReader.MoveToContent();
object nodeName = projectReader.NameTable.Add("ProjectGuid");
while (projectReader.Read())
{
if (Object.Equals(projectReader.LocalName, nodeName))
{
projectGuid = projectReader.ReadElementContentAsString();
break;
}
}
}
IVsHierarchy hier = VsShellUtilities.GetHierarchy(serviceProvider, new Guid(projectGuid));
sln.CloseSolutionElement((uint)__VSSLNCLOSEOPTIONS.SLNCLOSEOPT_UnloadProject, hier, 0);
String bistroPath = (String)Registry.LocalMachine.CreateSubKey(@"Software\Hill30\Bistro").GetValue("InstallDir");
#if VS2008
String ndjangoPath = (String)Registry.LocalMachine.CreateSubKey(@"Software\Hill30\NDjango").GetValue("InstallDir2008");
#elif VS2010
String ndjangoPath = (String)Registry.LocalMachine.CreateSubKey(@"Software\Hill30\NDjango").GetValue("InstallDir2010");
#endif
StreamReader reader = new StreamReader(fileName);
string content = reader.ReadToEnd();
reader.Close();
content = content.Replace(BISTRODIR, (bistroPath == null) ? BISTRODIR : Path.GetFullPath(bistroPath)).
Replace(NDJANGODIR, (ndjangoPath == null) ? NDJANGODIR : Path.GetFullPath(ndjangoPath));
StreamWriter sw = new StreamWriter(fileName);
sw.Write(content);
sw.Close();
IntPtr ppProject = IntPtr.Zero;
Guid guid1 = new Guid();
Guid guid2 = new Guid();
sln.CreateProject(ref guid1, fileName, null, null, (uint)__VSCREATEPROJFLAGS.CPF_OPENFILE, ref guid2, out ppProject);
}