2013-03-11 134 views
2

我正在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 =....................??????????? 

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

回答

1

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

返回的字符串将具有格式“路径:\目录”,因此您将不得不修剪前6个字符以使用它作为程序中的路径字符串。这是我如何使用它在我的程序之一

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