Custom Component Depoloyment (ESRI) – better to use TARGETDIR

I think ESRI may be wrong on how to properly set up a custom installer for your custom dll’s for ArcMap etc.

How to deploy a custom component using a setup project

 

custom install

 

It’s basically implying that you should use:

[ProgramFilesFolder]\[ProductName]\bin\foo.dll

Which translates to soemthing like “C:\Program Files(x86)\MyCompany\bin\foo.dll”

But this may not always be true, what happens when your user wants to install to a custom installation directory?  The ESRIRegAsm.exe tool will always fire against – C:\Program Files(x86)\MyCompany\bin\foo.dll, and not where the user selected to install! – it’s basically hard wired so that means your customers could have problems trying to install your software.  It’s better to use:

[TARGETDIR]foo.dll

Which is basically the value you get back from this stage in the installation process (although it’s not very clear as you don’t see that as a variable in the properties window for this stage!):

install folder

 

This will then run ESRIRegAsm.exe against where the user decided to install your dll’s, properly installing the dlls into ArcMap etc.  This is, I believe more foolproof.  However if I have got this wrong, I’m happy to be proved wrong 🙂

Advertisements
Custom Component Depoloyment (ESRI) – better to use TARGETDIR

How to Show Click Once version in form title text

I think it’s handy to show the version of your software sometimes in the title text of your form to make sure you can see at a glance that the click once distro is the same as the program that is currently running on a PC. In order to achieve this do the following:

Make sure add a reference in your project to System.Deployment as well as the including the using statement.  You need this in order to access some specific libraries in this assembley.

In your initialisation of your form you should check to see that the version running has been deployed by Click Once.  This means that debug versions of this won’t work but live deployed versions will – if you don’t do this you will get an exception.

See code below:

           if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
            {
                    this.Text = String.Format("My Foo Program {0}",
                    System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion);
            }
How to Show Click Once version in form title text