在 vsix 项目中访问当前打开的解决方案 [英] Acessing currently opened solution in a vsix project

查看:21
本文介绍了在 vsix 项目中访问当前打开的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从 vsix 项目访问当前在 Visual Studio 中打开的解决方案的路径.我怎样才能得到它?

I want to access the path to currently open solution in Visual Studio from a vsix project. How can I get that?

此线程会说明解决方案是否已打开 但未提供有关已打开解决方案的路径

This thread tells if a solution is open or not but gives nothing about the path of the opened solution

推荐答案

我用这个:

    public string GetInitialFolder(DTE dte)
    {
        if (!dte.Solution.IsOpen)
            return null;
        return System.IO.Path.GetDirectoryName(dte.Solution.FullName);
    }

但是期望它会出错,有时它无法返回路径!

But expect it to error, sometimes it cannot return a path!

这篇关于在 vsix 项目中访问当前打开的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆