0

I am using SharpDevelop , but after I installed my application, especially for Enterprise Architect, I need to know where is the location that the user have chosen through the setup process, because it is important for me to read some data by my Add-in (MyApp) which are already installed in the target path when user install my tool.

I tried to add some RegKeys during installation steps, but I could not hold the path, because basically user can change the path easily ..

            <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>

Regards,

user253008
  • 143
  • 6
  • There are holo tickboxes next to each answer, marking answers as correct gets you 2 points. If the answer below doesn't solve your question, dont mark as correct and do more research to find other methods, like this one: http://stackoverflow.com/questions/26613336/find-if-3rd-party-software-is-installed-the-install-path-and-the-exes-name – Jeremy Thompson Jun 03 '15 at 04:50

1 Answers1

2

If your add-in is running in EA then you should be able to get the correct directory using something like

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

or

System.IO.Path.GetDirectoryName(
      System.Reflection.Assembly.GetEntryAssembly().Location);

or a variation thereof

Just make sure you somehow get a hold of the assembly you are interested in and get its location through Reflection.

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50