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() / ...
随机推荐
- 19-MySQL-Ubuntu-数据表的查询-自关联(八)
自关联 转自:https://blog.csdn.net/hubingzhong/article/details/81277220
- POJ 3237 /// 树链剖分 线段树区间修改(*-1)
题目大意: 给定树的N个结点 编号为1到N 给定N-1条边的边权. 三种操作: CHANGE k w:将第 k 条边的权值改成 w. NEGATE x y:将x到y的路径上所有边的权值乘 -1. QU ...
- 关于ctype.h头文件使用说明
ctype.h里的函数概况: 1.字符测试函数 (1)函数原型均为 int isXXX( int ch) (2)参数为int,任何参数均被转换为整形 (3)只能处理[0,127]之间的值 2.字符映射 ...
- css元素垂直居中
一.碎碎念:啊啊啊,原谅我只能起一个酱紫微大众微俗气的标题,因为实在没有什么能比这样表达的更清楚直观了呢! 二.没有知识储备,直接上示例: 1.思路:给父元素添加display: table属性:给子 ...
- await和async
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Android studio 添加引用Module项目 与 设置Module项目的Libs的Jar在主项目里使用
前言 添加引用Module项目 设置Module项目的Libs的Jar在主项目里使用 1.在项目里添加libs包,并且加入jar 2.设置这个module项目的build.gradle depende ...
- CF850E Random Elections
题意:一共有n个人,要在三个人中选prefer,一开始他们心中都会想好他们的排名(共6种),之后给出的判断不会矛盾.规则如下:一共有三轮,分别是a->b,b->c,c->a,每个人选 ...
- mfcs100d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)
转自VC错误:http://www.vcerror.com/?p=55 问题描述: mfcs100d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 al ...
- System.Web.HttpSessionStateBase.cs
ylbtech-System.Web.HttpSessionStateBase.cs 1.程序集 System.Web, Version=4.0.0.0, Culture=neutral, Publi ...
- tomcat mysql 练习
[root@k8s-master tomcat_demo]# cat mysql-rc.yml apiVersion: v1 kind: ReplicationController metadata: ...