【问题标题】:How to Access Bin Folder of Active Project using visual studio 2010 add in如何使用 Visual Studio 2010 添加访问活动项目的 Bin 文件夹
【发布时间】:2013-08-22 09:34:47
【问题描述】:

我想使用创建加载项项目后获得的对象 (_applicationObject) 访问活动项目的 Bin 文件夹 到目前为止我的代码:

object ob = _applicationObject.ActiveSolutionProjects;
 // i want this result
 // D:/Myproject/Bin

【问题讨论】:

    标签: c# .net visual-studio-2010 visual-studio-addins


    【解决方案1】:
    Environment.CurrentDirectory
    

    返回当前工作目录。

    或者你可以使用

    System.Reflection.Assembly.GetExecutingAssembly().Location

    【讨论】:

    • 我想要所选项目的当前目录而不是 addIn 项目
    • System.Reflection.Assembly.GetExecutingAssembly().Location 此代码获取插件的位置而不是所选项目的位置
    • 是要获取主项目的bin文件夹还是插件项目(类库)?
    • 如果要获取主项目的 bin 文件夹,请使用 Directory.GetParent(Environment.CurrentDirectory).Parent.FullName;通常我们将插件 dll 放在主项目下的文件夹中,当前来自 dll 的 Directory 调用将始终返回文件夹路径。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多