none
How do I get the version of Office loading me in my shim? RRS feed

All replies

  • Hi Dave,

    Most Office applications provide the Application.Version property. What versions of what Office applications do you need to support?

    > And where is the code for the latest/greatest version of the shim code?

    Sorry?


    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader
    Thursday, January 5, 2012 5:20 AM
  • Hi Dave,

    You can use application parameter of OnConnection event to retrieve the version property via late binding:

    		public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
    		{
    			applicationObject = application;
    
                string version = applicationObject.GetType().InvokeMember("Version", 
                    System.Reflection.BindingFlags.GetProperty, null, applicationObject, null).ToString();
    
    			addInInstance = addInInst;
    		}
    

    I hope this helps.


    Calvin Gao[MSFT]
    MSDN Community Support | Feedback to us
    Thursday, January 5, 2012 9:11 AM
    Moderator
  • Hi Calvin;

    That won't work because our AddIn is loaded by that time. We need to know it before the call to IfFailGo( CreateAppDomain(szAssemblyConfigName) ); in HRESULT CCLRLoader::CreateAggregatedAddIn() (in the file CLRLoader.cpp).

    How can we get it this early?

    thanks - dave


    The Programming Olympics - Code Wars
    Thursday, January 5, 2012 10:43 PM
  • Most Office applications provide the Application.Version property. What versions of what Office applications do you need to support?

    We need to load a different AddIn depending on the version of Office that is loading the shim. 2002 - 2010 at present.

    > And where is the code for the latest/greatest version of the shim code?

    The code that allows you to sign an AddIn that is a .net IExtensibility AddIn. The version we are using generates lots of warning when it compiles.

    thanks - dave


    The Programming Olympics - Code Wars
    Thursday, January 5, 2012 10:45 PM
  • Hi Dave,

    I found a blog which provide a workaround for the situation which is similar with yours somehow: SharePoint solution for both SPS 2003 and 2007 version.

    You maybe can get some ideas from this:

    http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html

    In addition, here is an another blog which you might want to have a look at:

    Add-ins for Multiple Office versions without PIAs

    I hope this helps.


    Calvin Gao[MSFT]
    MSDN Community Support | Feedback to us

    Friday, January 6, 2012 3:38 AM
    Moderator
  • Hi;

    That looks like a solution but one that requires a lot of work. I'm hoping there's an easier way and so I posted a new question asking if there are other approaches.

    thanks - dave


    The Programming Olympics - Code Wars
    Friday, January 6, 2012 8:07 PM