Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在SharpDevelop中找到安装路径_C#_Enterprise Architect_Sharpdevelop - Fatal编程技术网

C# 在SharpDevelop中找到安装路径

C# 在SharpDevelop中找到安装路径,c#,enterprise-architect,sharpdevelop,C#,Enterprise Architect,Sharpdevelop,我使用的是SharpDevelop,但在安装我的应用程序后,尤其是对于Enterprise Architect,我需要知道用户在安装过程中选择的位置,因为通过我的加载项(MyApp)读取一些数据对我来说很重要用户安装“我的工具”时已安装在目标路径中的 我试图在安装步骤中添加一些regkey,但我无法保留路径,因为基本上用户可以轻松更改路径 <Component Id="setuppath" Guid="FF2212C1-9374-5167-9E1F-3086284B

我使用的是SharpDevelop,但在安装我的应用程序后,尤其是对于Enterprise Architect,我需要知道用户在安装过程中选择的位置,因为通过我的加载项(MyApp)读取一些数据对我来说很重要用户安装“我的工具”时已安装在目标路径中的

我试图在安装步骤中添加一些regkey,但我无法保留路径,因为基本上用户可以轻松更改路径

            <Component Id="setuppath" Guid="FF2212C1-9374-5167-9E1F-3086284BED66" >
                <RegistryKey Root="HKLM" Key="Software\Sparx Systems\DrawUML3D" Action="createAndRemoveOnUninstall">
                    <RegistryValue Type="string" Value="1000" />
                </RegistryKey>
            </Component>


关于,

如果您的外接程序在EA中运行,那么您应该能够使用以下方法获得正确的目录

System.IO.Path.GetDirectoryName( 
      System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );

或其变体


只需确保你以某种方式掌握了你感兴趣的组件,并通过反射获得其位置。

每个答案旁边都有全息勾选框,将答案标记为正确将得到2分。如果以下答案不能解决您的问题,请不要将其标记为正确,并进行更多研究以找到其他方法,如以下方法:
System.IO.Path.GetDirectoryName(
      System.Reflection.Assembly.GetEntryAssembly().Location);