<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Vault extension update in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/vault-extension-update/m-p/13432456#M71</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do the same thing but a different way - all users get a simple addin installed during vault upgrades which checks for updates and loads the main extension so that way I don't have to push to all user individually, I just have to update one server location that the extension reads from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For vault and inventor, instead of writing them as a normal addin, I load the main content and pass the API methods to it. Here is a sample of my loader vault extension.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The downside to this method, is that the user cannot easily unload the extension from inventor (vault cannot unload anyways), but that is not an issue for me.&lt;/P&gt;&lt;P&gt;The other tricky part is updating the loader extension if needed, but that is a separate matter, and should not really need to happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Threading;

using Autodesk.Connectivity.Explorer.Extensibility;
using Autodesk.Connectivity.Extensibility.Framework;

[assembly: ApiVersion("18.0")] //15=vault2022, 16=vault 2023, 18 = vault 2025
[assembly: ExtensionId("da91ef70-50cd-48d2-a38a-5ccc8415493f")]

namespace VaultExtension
{
    public class VaultExtension : IExplorerExtension
    {
        public VaultExtension()
        {
            Debug.Print("Vault extension loading");
        }

        public IExplorerExtension content;

        public void OnStartup(IApplication application)
        {
			//Directory structure is
			//	VaultExtension
			//		VaultExtension.dll
			//		VaultExtensionContent
			//			VaultExtensionContent.dll
            string loc = GetType().Assembly.Location; // gets the addin dll path
            string sourceDirectory = Path.GetDirectoryName(loc);
            string targetDirectory = Path.Combine(sourceDirectory, "VaultExtensionContent");
            string targetDll = Path.Combine(targetDirectory, "VaultExtensionContent.dll");

            var vltprocs = Process.GetProcessesByName("Connectivity.VaultPro");
            if(vltprocs.Length == 1)
            {
                //update the content assembly from the server or whatever.
				//if more than 1 vault instance is running, then we won't be able to update as the dll will be locked. We can just wait until next time.
            }

            try
            {
                if(System.IO.File.Exists(targetDll))
                {
                    var contentAssembly = Assembly.LoadFrom(targetDll); // loadfrom will load dependency dlls that are in the same dir, loadfile does not
                    content = (IExplorerExtension)contentAssembly.CreateInstance("VaultExtension.VaultExtensionContent", true, default, default, new object[] { application }, CultureInfo.CurrentCulture, default);
                    content?.OnStartup(application);
                }
            }
            catch
            {
                System.Threading.ThreadPool.QueueUserWorkItem(_ =&amp;gt; MessageBox.Show("Could Not Load VaultExtension Content Assembly!", "VaultExtension Load Error", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly));
                return;
            }
        }
        
		//pass all the extension methods to the content assembly
        public void OnLogOn(IApplication application)
        {
            content?.OnLogOn(application);
        }

        public IEnumerable&amp;lt;CommandSite&amp;gt; CommandSites()
        {
            return content?.CommandSites();
        }

        public IEnumerable&amp;lt;string&amp;gt; HiddenCommands()
        {
            return content?.HiddenCommands();
        }

        public void OnShutdown(IApplication application)
        {
            content?.OnShutdown(application);
        }

        public void OnLogOff(IApplication application)
        {
            content?.OnLogOff(application);
        }

        public IEnumerable&amp;lt;DetailPaneTab&amp;gt; DetailTabs()
        {
            return content?.DetailTabs();
        }

        public IEnumerable&amp;lt;CustomEntityHandler&amp;gt; CustomEntityHandlers()
        {
            return content?.CustomEntityHandlers();
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Apr 2025 11:17:09 GMT</pubDate>
    <dc:creator>g.georgiades</dc:creator>
    <dc:date>2025-04-18T11:17:09Z</dc:date>
    <item>
      <title>Vault extension update</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/vault-extension-update/m-p/13431190#M70</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Inventor, I created an AddIn that I let automatically update by an other AddIn.&lt;/P&gt;&lt;P&gt;I do this by have the "update AddIn" start automatically and look through the AddIns.&amp;nbsp;Then I let it first perform an update on the actual addin and after that active it.&lt;/P&gt;&lt;P&gt;Sample:&lt;/P&gt;&lt;P&gt;For Each InventorAddIn As ApplicationAddIn In Addins&lt;/P&gt;&lt;P&gt;If InventorAddIn.ClientId = "TargetAddInClientId" Then&lt;/P&gt;&lt;P&gt;UpdateAddIn&lt;/P&gt;&lt;P&gt;InventorAddIn.Activate()&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;This works well, as it is updates at the start of Inventor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I try the same trick in Vault, there doesn't seem to be any way to manage AddIns, or extensions, as it's called in Vault.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I search a bit, the only idea I can find is to kill Vault on start to perform an update,&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/vault-customization/killing-vault-on-onstartup-when-needed/td-p/9658215" target="_blank"&gt;https://forums.autodesk.com/t5/vault-customization/killing-vault-on-onstartup-when-needed/td-p/9658215&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This could work, but are there other ways? Does anyone has ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 14:51:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/vault-extension-update/m-p/13431190#M70</guid>
      <dc:creator>laurence.roijackers</dc:creator>
      <dc:date>2025-04-17T14:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Vault extension update</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/vault-extension-update/m-p/13432456#M71</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do the same thing but a different way - all users get a simple addin installed during vault upgrades which checks for updates and loads the main extension so that way I don't have to push to all user individually, I just have to update one server location that the extension reads from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For vault and inventor, instead of writing them as a normal addin, I load the main content and pass the API methods to it. Here is a sample of my loader vault extension.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The downside to this method, is that the user cannot easily unload the extension from inventor (vault cannot unload anyways), but that is not an issue for me.&lt;/P&gt;&lt;P&gt;The other tricky part is updating the loader extension if needed, but that is a separate matter, and should not really need to happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Threading;

using Autodesk.Connectivity.Explorer.Extensibility;
using Autodesk.Connectivity.Extensibility.Framework;

[assembly: ApiVersion("18.0")] //15=vault2022, 16=vault 2023, 18 = vault 2025
[assembly: ExtensionId("da91ef70-50cd-48d2-a38a-5ccc8415493f")]

namespace VaultExtension
{
    public class VaultExtension : IExplorerExtension
    {
        public VaultExtension()
        {
            Debug.Print("Vault extension loading");
        }

        public IExplorerExtension content;

        public void OnStartup(IApplication application)
        {
			//Directory structure is
			//	VaultExtension
			//		VaultExtension.dll
			//		VaultExtensionContent
			//			VaultExtensionContent.dll
            string loc = GetType().Assembly.Location; // gets the addin dll path
            string sourceDirectory = Path.GetDirectoryName(loc);
            string targetDirectory = Path.Combine(sourceDirectory, "VaultExtensionContent");
            string targetDll = Path.Combine(targetDirectory, "VaultExtensionContent.dll");

            var vltprocs = Process.GetProcessesByName("Connectivity.VaultPro");
            if(vltprocs.Length == 1)
            {
                //update the content assembly from the server or whatever.
				//if more than 1 vault instance is running, then we won't be able to update as the dll will be locked. We can just wait until next time.
            }

            try
            {
                if(System.IO.File.Exists(targetDll))
                {
                    var contentAssembly = Assembly.LoadFrom(targetDll); // loadfrom will load dependency dlls that are in the same dir, loadfile does not
                    content = (IExplorerExtension)contentAssembly.CreateInstance("VaultExtension.VaultExtensionContent", true, default, default, new object[] { application }, CultureInfo.CurrentCulture, default);
                    content?.OnStartup(application);
                }
            }
            catch
            {
                System.Threading.ThreadPool.QueueUserWorkItem(_ =&amp;gt; MessageBox.Show("Could Not Load VaultExtension Content Assembly!", "VaultExtension Load Error", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly));
                return;
            }
        }
        
		//pass all the extension methods to the content assembly
        public void OnLogOn(IApplication application)
        {
            content?.OnLogOn(application);
        }

        public IEnumerable&amp;lt;CommandSite&amp;gt; CommandSites()
        {
            return content?.CommandSites();
        }

        public IEnumerable&amp;lt;string&amp;gt; HiddenCommands()
        {
            return content?.HiddenCommands();
        }

        public void OnShutdown(IApplication application)
        {
            content?.OnShutdown(application);
        }

        public void OnLogOff(IApplication application)
        {
            content?.OnLogOff(application);
        }

        public IEnumerable&amp;lt;DetailPaneTab&amp;gt; DetailTabs()
        {
            return content?.DetailTabs();
        }

        public IEnumerable&amp;lt;CustomEntityHandler&amp;gt; CustomEntityHandlers()
        {
            return content?.CustomEntityHandlers();
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 11:17:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/vault-extension-update/m-p/13432456#M71</guid>
      <dc:creator>g.georgiades</dc:creator>
      <dc:date>2025-04-18T11:17:09Z</dc:date>
    </item>
  </channel>
</rss>

