vb.net 如何获取安装/安装项目中的当前工作目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15337230/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 12:43:50  来源:igfitidea点击:

How do can I get the current working directory inside a Setup/Installation project

vb.netadd-invisual-sourcesafe

提问by jeegnesh

I am makeing add-in application in vb.net and also making setup for that, but i need some help in instller.vb class file

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

i want to copy TestAddIn.addin file to client location,and this is added with setup file how can i do code in installer file that it copy to client machine?

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

target path :

目标路径:

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

source path:

源路径:

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

what to write in source path that give me current working directory?

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

回答by Wayne

This is similar to the question executable directory where application is running from; the answer provided by Justin Niessner is a very good solution and will return the path of the currently executing application

这类似于运行应用程序的问题可执行目录;Justin Niessner 提供的答案是一个很好的解决方案,将返回当前正在执行的应用程序的路径

The returned string will have the format "Path:\Directory" so you will have to trim the first 6 characters to use it as a path string in your program. This is how I used it in one of my programs

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

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