02.vs插件 获取项目和解决方案路径
获取项目 解决方案路径
/// <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插件 获取项目和解决方案路径的更多相关文章
- Java获取项目中的路径 分类: Java Game 2014-08-14 10:17 122人阅读 评论(0) 收藏
在项目中经常需要获取某个文件的路径: 在这里提供一些获取路径的方法.. 1.此种方式获取的路径,是当前类所在的路径: UserDAOTest.class.getResource("UserD ...
- springboot获取项目的绝对路径和根目录
springboot获取当前项目路径的地址 System.getProperty("user.dir") 输出目录: G:\outshine\wangsoso //获取class ...
- Python - 超好用的第三方库pathlib,快速获取项目中各种路径
前言 之前曾介绍过Python的os库详细使用方式,具体可看看这篇博文:https://www.cnblogs.com/poloyy/p/12341231.html 博主在学完os库之后,就开始投入使 ...
- python 获取项目的根路径
root_path = os.path.abspath(os.path.dirname(__file__)).split('shippingSchedule')[0] shippingSchedule ...
- String.valueOf(Thread.currentThread().getContextClassLoader().getResource("")) 获取项目的绝对路径(shiro项目中来的八)
一,上代码 String.valueOf(Thread.currentThread().getContextClassLoader().getResource("")) file: ...
- jsp笔记----jsp常用的的获取项目的根路径
<% String path = request.getContextPath(); String basePath = request.getScheme() + "://" ...
- 易宝支付Demo,生产中封装成简洁的代付接口,不用request如何获取项目运行时的真实路径
最近项目在做融360引流,涉及到了易宝支付的代扣和代付.易宝官方给出的demo只能简单运行,而且都是通过form表单的形式提交,返回XML格式.同时接口代码都写在了JSP中看起来不友好.项目在生成中想 ...
- jdk1.8中获取项目绝对路径和项目路径
request.getSession().getServletContext().getRealPath("") 获取项目的绝对路径,含着项目的名称. request.getSe ...
- java获取项目路径,url路径
我的web项目名iamgeModel. 工作空间在D盘 先获取url相关: 需要是HttpServletRequest request; 获取IP: request.getServerName() / ...
随机推荐
- 《转》python 12 列表解析
转自 http://www.cnblogs.com/BeginMan/p/3164937.html 一.列表解析 列表解析来自函数式编程语言(haskell),语法如下: [expr for iter ...
- 18-MySQL-Ubuntu-数据表的查询-连接(七)
students与classes表,两个表的连接字段是students.cls_id=classes.ID (1) 左连接:left join on 左边表全取,右边表取共有的,没有的为null se ...
- PAT L2-021. 点赞狂魔 /// sort+unique去重
https://www.patest.cn/contests/gplt/L2-021 题目大意: 微博上有个“点赞”功能,你可以为你喜欢的博文点个赞表示支持.每篇博文都有一些刻画其特性的标签,而你点赞 ...
- GetOpenFilename的基本用法(文件夹实操)
Sub 数据导入()Dim f, arr, i&, j&, k, m%, n%, p%, sh As Workbookf = Application.GetOpenFilename(f ...
- 同步图计算实现最短路径Dijkstra算法
同上篇讲述pageRank一样,考虑一个顶点V. 根据顶点算法通常步骤1) 接收上个超步发出的入邻居的消息2) 计算当前顶点的值3) 向出邻居发消息 1.接收入邻居的消息 2.求入邻居的最小值,加上顶 ...
- Algo: Majority Element
Approach #1 Brute Force Intuition We can exhaust the search space in quadratic time by checking w ...
- css---文本新增样式
opacity属性指定了一个元素的透明度 默认值:1.0 不可继承 兼容性不是太好 兼容性写法 opacity{ opacity:0.5; filter:alpha(opacity=); //f ...
- Excel宏开发之合并单元格
合并单元格 Sub 宏1() ' ' 宏1 宏 ' ' 快捷键: Ctrl+q ' Application.Goto Reference:="宏1" Application.VBE ...
- jdk配置到tomcat配置
1.jdk配置 首先下载jdk 这里我下载的是 jdk1.8 (jdk1.8.0_181\) 然后,安装 我的安装路径 C:\Program Files\Java\jdk1.8.0_181\ 我选择默 ...
- 解决Delphi 2010启动时卡死并报displayNotification堆栈溢出错误
1. 清理IE的历史记录,删除浏览器缓存(不需要清cookie) 2. 禁用startpage 2.1 从 Delphi 2010 启动菜单上点右键 -> 查看属性->快捷方式->目 ...