【问题标题】:How do can I get the current working directory inside a Setup/Installation project如何在设置/安装项目中获取当前工作目录
【发布时间】:2013-02-26 13:11:21
【问题描述】:

我正在 vb.net 中制作插件应用程序 并为此进行设置,但我需要 instller.vb 类文件中的一些帮助

我想将 TestAddIn.addin 文件复制到客户端位置,这是与安装文件一起添加的 如何将安装程序文件中的代码复制到客户端计算机?

目标路径:

Dim addinTargetPath As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Visual Studio 2008\Addins")

源路径:

dim addinsourcePath As String =....................???????????

在给我当前工作目录的源路径中写什么?

【问题讨论】:

    标签: vb.net add-in visual-sourcesafe


    【解决方案1】:

    这类似于问题executable directory where application is running from; Justin Niessner 提供的答案是一个非常好的解决方案,并且会返回当前正在执行的应用程序的路径

    返回的字符串格式为“Path:\Directory”,因此您必须修剪前 6 个字符才能将其用作程序中的路径字符串。这就是我在我的一个程序中使用它的方式

    strPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase)
    i = strPath.Count
    strPath = strPath.Substring(6, i - 6)
    

    【讨论】:

      【解决方案2】:

      【讨论】:

      • 这段代码给了我windows32目录的路径,我想要我的设置所在的路径?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-06
      • 1970-01-01
      • 1970-01-01
      • 2011-06-19
      • 2021-01-18
      相关资源
      最近更新 更多