我想获取应用程序bin / debug-path [英] I want to get the application bin/debug-path
问题描述
我希望在 DesignTime期间获取应用程序包/调试路径
使用Google我发现了几个条目(例如StackOverFlow) )但他们都没有工作......
我尝试过:
Application.CommonAppDataPath
Application.ExecutablePath
Application.StartupPath
Application.LocalUserAppDataPath
汇编。 GetEntryAssembly.CodeBase
Directory.GetCurrentDirectory
AppDomain.CurrentDomain.BaseDirectory
My.Application.Info.DirectoryPath
以上都没有提供正确的路径...... :(
I want to get the Application Bin/Debug-Path during DesignTime
With Google I found several entries (for example an StackOverFlow) but none of them are working ...
What I have tried:
Application.CommonAppDataPath
Application.ExecutablePath
Application.StartupPath
Application.LocalUserAppDataPath
Assembly.GetEntryAssembly.CodeBase
Directory.GetCurrentDirectory
AppDomain.CurrentDomain.BaseDirectory
My.Application.Info.DirectoryPath
None of them above deliver the right path ... :(
推荐答案
不是整个解决方案而是其中的一部分。
此代码片段给出了项目路径:
Not the whole Solution but a part of it.
This code-snippet gives the Project-path :
Dim dte As EnvDTE.DTE = System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE")
Dim dir As String = Path.GetDirectoryName(dte.Solution.FullName)
为了使它工作,有必要添加对Microsoft.Development Environment的引用
另请参阅:引用DTE对象 [ ^ ]
这篇关于我想获取应用程序bin / debug-path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!