-1

I am developing an extension for ArcGIS 10.3 using ArcObjects in c# and it uses a database (.sdf). I want to setup the extension in such a way that when extension is installed (it is ArcGIS AddIn), it copy the .sdf file from the source folder to the user's folder (common location so that Extension in ArcGIS can access and read from there) in Windows 7.

closed as off-topic by PolyGeo Mar 3 '16 at 2:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I don't know a way to execute custom action inside the installation process of an AddIn. I would suggest to create a batch or a powershell script that copies your database into the user folder and afterwards starts the AddIn install process. Your customer only needs to run the script instead of double clicking the AddIn. Alternative you can copy the database inside the 'OnStartup()' method if it doesn't exist. But this happens not during the installion but every time the Extension is loaded. – Propper Jan 7 '16 at 8:56
  • Many thanks Propper. Can you provide me a script for AddIn installation and uninstall as I am not good with such scripts. Another question, is it possible to know the path from where the AddIn was installed. I was thinking that if I can track the Path of AddIn installation, I can check inside the code if the database is not at destination location, copy it from the installation folder. – Hussain Jan 7 '16 at 15:16
1

You simply need to modify the following lines and save them into a batch file (for example install.bat).

copy e:\database\myDatabase.sdf %USERPROFILE%\AppData\Roaming\ProgramFolder

The first parameter is the source path of the database. The second parameter is the destination path. %USERPROFILE% stands for the current users home directory. You can modify the subdirectories the way you need. The second line in the batch script is:

start MyAddIn.esriAddIn

Your operating system will know the file extension .esriaddin and start the installation.

For the uninstall you can find an answer here. You can add the described commands in an uninstall.bat and add the following line to delete the database afterwards:

del %USERPROFILE%\AppData\Roaming\ProgramFolder\myDatabase.sdf

Not the answer you're looking for? Browse other questions tagged or ask your own question.