获取项目 解决方案路径

   /// <summary>
/// 获取并设置项目和解决方案绝对路径
/// </summary>
/// <returns></returns>
protected void GetSetPath()
{
var dte2 = Package.GetGlobalService(typeof(DTE)) as DTE2;
var solution = dte2.Solution;
//var projects = solution.Projects; var projects = (UIHierarchyItem[])dte2?.ToolWindows.SolutionExplorer.SelectedItems;
var project = projects[].Object as Project; var SolutionName = Path.GetFileName(solution.FullName);//解决方案名称
var SolutionDir = Path.GetDirectoryName(solution.FullName);//解决方案路径
var ProjectName = Path.GetFileName(project.FullName);//项目名称
var ProjectDir = Path.GetDirectoryName(project.FullName);//项目路径
}
    var dte2 = this.Dte2;

    var solution = dte2.Solution;
//var projects = solution.Projects; var projects = (UIHierarchyItem[])dte2?.ToolWindows.SolutionExplorer.SelectedItems;
var project = projects[].Object as Project; //获取项目所有引用
var vsproject = project.Object as VSLangProj.VSProject;
foreach (VSLangProj.Reference reference in vsproject.References)
{
if (reference.SourceProject == null)
{
// This is an assembly reference
var fullName = GetFullName(reference);
var assemblyName = new AssemblyName(fullName);
}
else
{
// This is a project reference
}
} this.Parameter.SolutionName = Path.GetFileName(solution.FullName);
this.Parameter.SolutionDir = Path.GetDirectoryName(solution.FullName);
this.Parameter.ProjectName = Path.GetFileName(project.FullName);
this.Parameter.ProjectDir = Path.GetDirectoryName(project.FullName);

弹窗提示

   /// <summary>
/// 警告
/// </summary>
/// <param name="body"></param>
protected void ShowMessageBox(string body, string title = "警告")
{
System.Windows.Forms.MessageBox.Show(body, title, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
}

02.vs插件 获取项目和解决方案路径的更多相关文章

  1. Java获取项目中的路径 分类: Java Game 2014-08-14 10:17 122人阅读 评论(0) 收藏

    在项目中经常需要获取某个文件的路径: 在这里提供一些获取路径的方法.. 1.此种方式获取的路径,是当前类所在的路径: UserDAOTest.class.getResource("UserD ...

  2. springboot获取项目的绝对路径和根目录

    springboot获取当前项目路径的地址 System.getProperty("user.dir") 输出目录:  G:\outshine\wangsoso //获取class ...

  3. Python - 超好用的第三方库pathlib,快速获取项目中各种路径

    前言 之前曾介绍过Python的os库详细使用方式,具体可看看这篇博文:https://www.cnblogs.com/poloyy/p/12341231.html 博主在学完os库之后,就开始投入使 ...

  4. python 获取项目的根路径

    root_path = os.path.abspath(os.path.dirname(__file__)).split('shippingSchedule')[0] shippingSchedule ...

  5. String.valueOf(Thread.currentThread().getContextClassLoader().getResource("")) 获取项目的绝对路径(shiro项目中来的八)

    一,上代码 String.valueOf(Thread.currentThread().getContextClassLoader().getResource("")) file: ...

  6. jsp笔记----jsp常用的的获取项目的根路径

    <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" ...

  7. 易宝支付Demo,生产中封装成简洁的代付接口,不用request如何获取项目运行时的真实路径

    最近项目在做融360引流,涉及到了易宝支付的代扣和代付.易宝官方给出的demo只能简单运行,而且都是通过form表单的形式提交,返回XML格式.同时接口代码都写在了JSP中看起来不友好.项目在生成中想 ...

  8. jdk1.8中获取项目绝对路径和项目路径

    request.getSession().getServletContext().getRealPath("")  获取项目的绝对路径,含着项目的名称. request.getSe ...

  9. java获取项目路径,url路径

    我的web项目名iamgeModel. 工作空间在D盘 先获取url相关: 需要是HttpServletRequest request; 获取IP: request.getServerName() / ...

随机推荐

  1. 《转》python 10 集合

    自 http://www.cnblogs.com/BeginMan/p/3160565.html 一.目录 1.集合概述 2.关于集合的操作符.关系符号 3.集合的一系列操作(添加.更新.访问.删除) ...

  2. Codeforces 479【F】div3

    题目链接:http://codeforces.com/problemset/problem/977/F 题意:给你一串数字序列,让你求最长上升子序列,但是这个子序列呢,它的数字得逐渐连续挨着. 题解: ...

  3. Window下,前后端分离项目,登录权限验证中的,Redis相关操作

    [1]官网下载Redis(解压版) https://redis.io/download [2]切换到目录下打开DOS,执行指令启动Redis redis-server.exe redis.window ...

  4. java面试官如何面试别人

                                                                                      java面试官如何面试别人(一) j ...

  5. !important的用法及作用

    定义及语法 !important,作用是提高指定样式规则的应用优先权(优先级).语法格式{ cssRule !important },即写在定义的最后面,例如:box{color:red !impor ...

  6. CSV导入到hive中,处理分号问题

    1.导入的原数据 103744;545479945;2017.05.17 06:41:08;sell;eurusd_;0.10;1.11080;1.11280;1.10880;1.11081;0.00 ...

  7. js 阻止事件

    event.stopPropagation();//阻止事件冒泡 ,可阻止父类事件的发生 event.preventDefault();//阻止默认行为 如A标签

  8. Java 几种队列区别的简单说明

    前言 队列,字面意思就可以明白. 是一种线性的数据暂存与管理工具. 也可以让各种业务功能进行逐个的队列运行. 此篇博客只说明一下Java有几种队列 未阻塞和阻塞队列的区别 未阻塞: 1.未阻塞的队列在 ...

  9. HTML清楚塌陷问题

    /* 清除浮动塌陷问题 */.clearfix:after { clear: both;} .clearfix:after,.clearfix:before { content: " &qu ...

  10. 网页存储倒计时与解决网页cookie保存多个相同key问题

    短信倒计时多用网页临时存储,这可以保证网页在关闭状态也可记时. <p class="test_button" id="getcode">获取验证码& ...