none
How to get VSTO source path for ClickOnce deployment RRS feed

  • Question

  • I have a VSTO addin for Outlook which would be deployed to different servers via UNC path, now what I want to accomplish is to detect the source UNC path on where the VSTO addin resides?

    E.g (file:///B:/deploy/OutlookAddin1.vsto) I will have to deploy this by another installer and then extract the files depending on where the client would want the files to be deployed.

    I've tried accessing the addin registry Manifest value "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\Outlook\Addins\OutlookAddin1", this proves to have solved the case but then ClickOnce applications proves to have limited access on the registry depending on the environment it runs on.

    Also I've tried using this code:

    Dim assemblyInfo As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
            'Location is where the assembly is run from 
            Dim assemblyLocation As String = assemblyInfo.Location
            'CodeBase is the location of the ClickOnce deployment files
            Dim uriCodeBase As Uri = New Uri(assemblyInfo.CodeBase)
            Dim ClickOnceLocation As String = IO.Path.GetDirectoryName(uriCodeBase.LocalPath.ToString())
    but doesn't return the right path of it. Any ideas on how to solve this? I know it could be done programmatically, I just don't know how yet.

    Tuesday, November 20, 2012 9:48 AM

Answers

  • Found the solution for this problem:

    Used the System.Deployment.Application reference, then using the UpdateLocation property I can then retrieve the deployment path

    Dim deployPath As String
    deployPath = ApplicationDeployment.CurrentDeployment.UpdateLocation.ToString()

    • Marked as answer by Khem Oco Wednesday, November 21, 2012 5:35 AM
    Wednesday, November 21, 2012 5:35 AM

All replies

  • not sure if this is what you want:

    AppDomain.CurrentDomain.BaseDirectory

    or try on CurrentDomain ApplicationIdentity or setupinformation

    Tuesday, November 20, 2012 10:04 AM
  • Thanks for the reply DamianD. The results for BaseDirectory and SetupInformation are the same with the code I've given above. It points out to the local user directory of the client not the UNC path where it was deployed.
    Wednesday, November 21, 2012 12:33 AM
  • In  Outlook > Trust Center >  Addins Window this information is what I would like to retrieve, is it possible? and can anyone give me a hint on how to access it?                                                            


    • Edited by Khem Oco Wednesday, November 21, 2012 12:46 AM
    Wednesday, November 21, 2012 12:44 AM
  • Found the solution for this problem:

    Used the System.Deployment.Application reference, then using the UpdateLocation property I can then retrieve the deployment path

    Dim deployPath As String
    deployPath = ApplicationDeployment.CurrentDeployment.UpdateLocation.ToString()

    • Marked as answer by Khem Oco Wednesday, November 21, 2012 5:35 AM
    Wednesday, November 21, 2012 5:35 AM