Updated COM Shim Wizards


In our spare time, Misha and I have been working on and off on the COM Shim and associated COM Shim Wizards for the last few years, and we’ve just published a new version  here: Isolating Microsoft Office Extensions with the COM Shim Wizard Version 2.3, with the accompanying download here.


The new version includes all the old projects for smart tags and RTD components – these have not changed since the previous version. The significant changes in the new version are all in the add-in shim and the add-in shim project wizard. Apart from minor bug fixes and code cleanup, the changes all relate to the new extensibility interfaces introduced with Office 2007. All the new interfaces are now supported in the shim (including IDocumentInspector, which is kind of redundant, but included for completeness). See my previous post on the new interfaces: Office 2007 New Extensibility Interfaces.


In another post, Why is it so hard to shim IRibbonExtensibility?, I discussed the reasoning behind the change in the shim design. Basically, it comes down to the need to support the potentially undefined methods on an automation interface (like IRibbonExtensibility). The IRibbonExtensibility interface only defines one method (GetCustomUI), but Office will expect to be able to call back on your IRibbonExtensibility object for any number of additional methods that are not defined in the interface. This is standard behavior for automation interfaces. For example, in your ribbon XML, you might specify that the callback method for a button is say MyButtonCallbackMethod, a method that is obviously not defined in the IRibbonExtensibility interface. Office uses the IDispatch interface implemented by all automation objects to call back on these “undefined” methods.


The same model is used for Excel automation add-ins. These can implement IDTExtensibility2, but they don’t have to. Indeed, they don’t have to implement any defined interface beyond IDispatch (the automation interface). All the UDFs will be automation methods.


The old add-in shim (and the shim for smart tags and RTD components) uses containment to proxy the defined method calls on the specific interfaces that the shim is shimming (IDTExtensibility2, ISmartTagRecognizer, ISmartTagAction, IRtdServer, etc). The new add-in shim still uses containment for the known interface it proxies (IDTExtensibility2), but it uses aggregation for the automation interfaces used in Ribbon customization and Excel automation add-ins (and potentially any other new automation interfaces that Office might introduce in later releases).


To achieve this aggregation, there’s a bit of work to call Marshal.CreateAggregatedObject – this is a static method in a sealed abstract base class in the .NET base class library. In order to call this from the (unmanaged) shim, we have to instantiate a tiny managed component to call it on our behalf. Hence the shim is now slightly more complex than it was – in that, it now has 2 pieces, one unmanaged (as before) and one managed. If you read my previous discussion of the reasoning behind this design, you’ll realize that we could have built the new shim in a much simpler way by overriding QueryInterface and blindly aggregating all the interfaces that we don’t proxy by containment. Right now, this would probably work, because right now Office doesn’t transition from any of these interfaces to any other interfaces. But, this model would break COM identity rules, and your shim would be broken if Office ever decided to optimize their interface querying differently from the way they do now. So, the slight added complexity of 2 pieces in the new shim is the price we pay for a robust model that is resilient to future changes, and doesn’t break any rules.


Our day job (or night job, in Misha’s case) is building VSTO, so it might seem strange that we spend our spare time building tools and components that support an alternative add-in model to VSTO. The simple fact is that we recognize that VSTO add-ins do not cover the totality of customer requirements (for example, no support for versions of Office earlier than 2003, and for “minor” Office apps such as Publisher). The main reason that VSTO doesn’t support all permutations is that the test matrix would be fantastically large. Everything is a trade-off, and we believe the trade-off between shipping good tools that cover some large percentage of customer requirements in a reasonable time frame, versus shipping tools that cover 100% of requirements in an unreasonably long time frame, is an optimal one. So, use VSTO where you can – and for those scenarios where you can’t, do shim your add-ins, and you can use the COM Shim Wizard tool to help you build suitable shims.

Comments (56)

  1. XL-Dennis says:

    Andrew,

    A huge Thank You! to You and to Misha.

    The simple fact is that we recognize that VSTO add-ins do

    not cover the totality of customer requirements

    When Orca is shipped then I believe it will be more interest in VSTO. Until then both unmanaged / managed COM add-ins will dominate the add-ins area etc.

    Kind regards,

    Dennis

  2. Abhi says:

    Hi Andrew, Misha,

    You people are really fantastic. This is so much unlike Microsoft I had experienced as a small independent consultant (esp your comment "…we recognize that VSTO add-ins do not cover …").

    Hats off to you. You have just shown how one can redefine boundaries and raise the bar. A perfect example of "embracing a new dawn while ensuring the dusk is carried along — not forgotten".

    Thank you Thank you Thank you Thank you Thank you Thank you (infinite times).

    Next time my wife screams at me for being late, I am going to make her read all your articles on Shim…. :)

  3. Sabrina says:

    Hi Andrew,

    When I use the Shim Wizard 2.3 I get a NullReferenceException at COMShimHarvester.CommonAssemblyPage.GetAssemblyDetails(string fileName) after selecting the assembly.

    When I try the wizard with one of the sample projects everything works fine. Do you know what could be the problem?

  4. andreww says:

    Sabrina – apologies for the slow response. The error suggests that the assembly was not found, or was not an add-in assembly. If the problem persists, please use the Email/Contact Form to send me more details.

  5. Richard says:

    Shim Wizards and Visual Studio 2008

    Are you intending to do a version of the Shim wizards for VS 2008?

  6. Richard says:

    Shim Wizards and Visual Studio 2008

    Are you intending to do a version of the Shim wizards for VS 2008?

  7. andreww says:

    Yes, we are planning to build a version of the COM Shim Wizards for VS 2008. Can’t say exactly when these will be released, but hopefully within the next couple months.

  8. Ken Slovak says:

    Hi Andrew,

    I’m strong naming my addin dll assembly with my own code signing certificate. Should I change the strong naming key file in the ManagedAggregator code signing properties to my PFX file from ManagedAggregator.snk?

    If I’m signing the addin dll and setup.msi are there any objections to signing the ManagedAggregator.dll and Shim.dll files?

    Thanks,

    Ken Slovak

  9. andreww says:

    Hi Ken

    Yes, if you’re using your own strong-naming key, it seems reasonable to use this for everything, and discard the .snk file generated by the wizard. Note that the ManagedAggregator project properties specify the name of the .snk to use.

    Note also that the code in the shim specifies the strong name of the ManagedAggregator – so if you change the .snk, you need to change the code in CCLRLoader::CreateAggregatedAddIn in the shim to correspond with it.

  10. Ken Slovak says:

    Thanks, Andrew, much appreciated.

  11. Ken Slovak says:

    Hi Andrew,

    I see a situation in Vista with Outlook 2007 when the Trust Center’s Add-ins tab setting for using macro security for addins is checked. The situation only occurs when using the new shim wizard (shim + ManagedAggregator), not with an older shim or unmanaged code.

    The addin dll, shim dll and aggregator are all strong named and signed using an Authenticode certificate. If Outlook addins are set to use the macro security unmanaged addins or older style shimmed addins fire a prompt to enable/disable/trust the addin. If I trust the certificate is added to the trusted publishers list, if I just enable I get prompted each time Outlook starts up.

    However, with the new shim wizard I get no prompts at all and the addin is just disabled with an error message listed of "Not loaded. Certificate of signed and load at startup COM Add-in is not in trusted source list."

    Since the prompt to trust/enable is there for unmanaged addins and managed addins using the old shims it appears that something in the new shim/managed aggregator is causing the addins to just be disabled and not fire the trust dialog.

    Have you seen this, and do you have any ideas about what is causing it and how to fix it?

    This only occurs on Vista, the same setup and addins running on WinXP with Outlook 2007 run just fine with the use macro security setting enabled.

    Thanks,

    Ken Slovak

  12. andreww says:

    Ken – please can you send us the MSI for your solution so we can try to repro it here?

    Thanks

    Andrew

  13. Ken Slovak says:

    Andrew,

    Send where? You can ping me at kenslovak@mvps.org if you want to set up the details for this off list.

    If you’re going to be at TechEd next week I can show it to you, I’ll be at ATE at TechEd.

    Thanks,

    Ken Slovak

  14. Ken Slovak says:

    I want to thank Andrew and Misha Shneerson for working on this problem with me. What we discovered is that the shim article at http://msdn.microsoft.com/en-us/library/bb508939.aspx omits a critical detail about the setup project after you add shimming using the Shim Wizard.

    The article mentions that you should add the primary outputs of the shim project and the Managed Aggregator project to the setup project along with the primary output of the addin project.

    Normally with an Office COM Addin you set the primary output to a registration setting of vsdrpCOM. When you add the primary outputs of the shim and Managed Aggregator projects to the setup project their registrations are set to vsdrpDoNotRegister.

    These settings are not correct and lead to problems running the addin under certain setups and Windows versions.

    The correct settings, and thanks again to Andrew and Misha for this, are:

    Shim project output: vsdrpCOM

    Addin, Managed Aggregator project outputs: vsdrpDoNotRegister

    With those settings the addin is correctly shimmed and loads and runs without errors.

    Ken Slovak

  15. Peter says:

    With Office 2003 and a managed automation add-in function shim, I had a problem where extensibility.dll was not present on users’ PCs. This caused an obscure atl error to be shown when the shim was loaded ("Release called on a pointer that has already been released"). I eventually tracked it down by adding a catch block in ManagedAggregator.CreateAggregatedInstance().

    I have extended the shims to allow a config file that specifies the default load location for all managed dlls in the created AppDomain – so that updates can be made without users quiting Excel – SmartTags and Managed Add-in functions lock the assemblies when in use.

    I am still looking for an programmatic way to obtain the dimensions of the range a managed function is called from in Excel – either as a worksheet function whose results can be passed into the function or from inside the function.

    Thanks for your great work and web pages – they have been really useful!

    peter2030@nospamML1.net

  16. Peter says:

    One other comment : I changed the .rgs files in the Shims to register in HKCU and regsitered them with RegSvrEx from CodeProject since the users don’t have admin rights.

  17. Mivoat says:

    In April you said a VS 2008 version might come along in a couple of months.  Any ETA?

    I’d like ot use Linq in my first OL 2007 Add In.

    Many thanks

  18. andreww says:

    Mivoat – thanks for reminding me. There was a delay in the publishing pipeline, but the new version should be available by the end of this month, or the first week in August.

  19. Andre says:

    Is the Com Shin for VS 2008 released?  Could you given a link so that we can download?

    A million thanks!!

  20. Joe says:

    Hi Andrew,

    Thanks for pointing out to add the ManangedAggregator project to the output! Com Shim is working fine on my PC now

    However, I tried to install it on a virtual machine running win xp and outlook 2007 and for some reason I’m getting this error when loading Outlook

    http://img373.imageshack.us/my.php?image=comshimerrorwy0.jpg

    It seems to be failing in the ManagedAggregator. Also, Outlook automatically disables my add-in when this pop up appears. Do you have an idea what might be causing this?

    Thanks in advance

  21. andreww says:

    Andre – yes, we’ve just published the updated version (2.3.1.0). The covering article is here: http://msdn.microsoft.com/en-us/library/bb508939.aspx (note, this replaces the 2.3 version).

    Download is here: http://www.microsoft.com/downloads/details.aspx?FamilyID=3e43bf08-5008-4bb6-aa85-93c1d902470e&displaylang=en

    My blog post on this is here: http://blogs.msdn.com/andreww/archive/2008/08/27/com-shim-wizard-2-3-1-0.aspx

  22. andreww says:

    Joe – please can you provide some more detail on this error? Can you post a stack trace at the point of failure?

  23. Andre says:

    Andrew,

    Thanks for your reply, however, I have some problem when using the COM Shin.  It shows an error that " Fail to retrieve all the required information from the managed extension assembly.  Please ensure that you have specified the correct assembly".  

    Here is the background:

    I have developed 2 dll, one is allow the function to be called in the excel cell and the other one allow to be called through VBA code.  Since I found my dll works fine in some machine, but some are not with different error message, therefore, I tried to search for the standard/right way to implement my managed dll for excel.  I understand that it might not be too appropriate to ask this type of question here, but I have read a lot of web site and people doing with a lot of different ways.  It would be really helpful if anyone can point me to some reference or tell me what is wrong on what I have been doing.

    For the one calling by the excel cell, I have done the following:

    1) Create a project through VS 2008 by choosing VS C# class library (.Net Framework 2.0, because it is used under Excel 2003)

    2) I follow the instruction here http://blogs.msdn.com/eric_carter/archive/2004/12/01/273127.aspx to made my own function. Highlight is here:

      Add [ComVisible(true)]

      Add [ClassInterface(ClassInterfaceType.Autodual)]

      Add the required static functions for registering the registry.

      Run regasm to register the dll

      Add/select the automation in excel

    For the dll which planing to use within excel:

    1) Create a project through VS 2008 by choosing VS C# class library (.Net Framework 2.0, because it is used under Excel 2003)

    2) I define a interface called IFunctions which expose the necessary methods:

      Add [System.Runtime.InteropServices.ComVisible(true)] in IFunctions

      Make public to interface IFunctions

    3) In the class file I do the following:

      Add [ComVisible(true)]

      Add [ClassInterface(ClassInterfaceType.None)]

      Write a class file which implement the IFunctions interface — public class Functions : IFunctions

    4) Run regasm to register the dll and generate the .tlb file

    5) Add reference to excel by importing the tlb file within the VBA editor and create an object by "Dim AddIn as "ClassObject")

    All dll are registered by regasm without strong name.

    Thank you very much!!!

  24. Joe says:

    Found what was the cause of the problem….I had to reference the Extensibility.dll in my setup project.

    What’s happening now is that in Outlook 2007 my addin is getting disabled. Even if I re-enable it, outlook disables it and displays the error ‘Not loaded. A runtime error occured during the loading of the COM Add-In’.

    I don’t think its going through the OnConnection event or any of the other events because my messageboxes aren’t coming up.

    Any ideas?

    Thanks

  25. Joe says:

    A small update : Just tried it on a PC with Outlook 2003 and the addin works! Do I have to do something different for Outlook 2007?

  26. andreww says:

    Andre – it looks like you’re creating standard class library DLLs. You cannot use the COM Shim Wizard to generate shims for these. You can use the COM Shim Wizard to generate shims for Excel automation add-in DLLs if and only if the DLL implements IDTExtensibility2.

    For a full discussion on your options with Excel managed UDFs, see MSDN Code Gallery here: http://code.msdn.microsoft.com/managedUDFs.

  27. andreww says:

    Joe – can you check to see if your add-in has been blacklisted? In the UI, go to the Trust Center, then add-ins, then disabled items. Alternatively, look in the registry to see if you have a key like this:

    HKCUSoftwareMicrosoftOffice(11.0|12.0)ResiliencyDisabledItems

  28. Joe says:

    My bad I used the wrong wording. Outlook is not disabling it – its setting it to inactive. Even when I re-active it Outlook still sets it back to inactive

  29. andreww says:

    Joe – please clarify: does that mean you have confirmed there is NOT a Resiliency entry in the registry for your add-in?

    If not, please turn on VSTO logging and alerts. See here for details: http://msdn.microsoft.com/en-us/library/ms269003(VS.80).aspx.

  30. Joe says:

    No there’s no resiliency entry in the registry for my add-in. I can confirm however that Outlook 2007 is soft disabling my addin since the load behaviour is always reset to 2. How can I debug my addin to see what’s going on? I’ve put a messagebox in the On Connection event but the messagebox is not firing, so its probably failing in the C++ modules of the com shim…

  31. Joe says:

    Oh I’ve tried the VSTO logging from the link you sent me – Nothing comes up, so I guess they don’t work for non VSTO addins

  32. andreww says:

    Joe – sorry, I confused the issue with the VSTO env-vars – yes, you’re right of course, these only apply to VSTO add-ins.

    The most likely reason for failure is if one of the pieces is missing. That is, the shim DLL, the ManagedAggregator, or the managed add-in DLL itself (and any dynamically-linked dependencies).

    If it’s not hitting the OnConnection in your managed add-in, you need to put breakpoints in the shim source code, and start debugging from there. If you like, you could start by putting MessageBox calls in the C++ code, like this:

       MessageBox(0, L"my message", 0, 0);

    Alternatively, use debug output messages like this:

       OutputDebugString(L"my message");

    (and then watch the output in a debug listener like DbgView – http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx).

    Better yet, just use VS to debug into the shim sources.

  33. Joe says:

    I had the office.dll dependency excluded for some reason. Its working fine now! Thanks for your time!

  34. bowman says:

    Andrew,

    Thanks for your (and Misha’s) help on this. I’m running into a hitch, I am trying to develop an addin for Excel that uses the Excel 9 OL (for backwards compatibility). I imported the library with the tlbimp tool and on my Excel 2003/VS 2005 development setup everything works great. When I apply this shim I cannot load my assembly in Excel. If I change the references to the Excel 2003 PIA, still using the shim, it works fine. I realize I am not giving too many details, but does this send off any flags?

  35. andreww says:

    bowman – first, did you know we’ve released an even newer version of the COM Shim Wizards? See here for details: http://blogs.msdn.com/andreww/archive/2008/08/27/com-shim-wizard-2-3-1-0.aspx

    Second, I did do some testing with Office 2000, 2002, 2003 and 2007, although admittedly I focused most tests on 2003 and 2007.

    I’m not sure why it should work with the 2003 PIAs and not your 2000 IA. Apart from that, the most likely explanation I can think of is that Excel 2000 is loading an earlier version of the CLR (probably 1.1), and the shim creates a ManagedAggregator object which relies on CLR 2.0 or later. Can you check to see which version of mscorwks.dll is getting loaded into the Excel process? (Use process explorer).

  36. bowman says:

    Andrew,

    Thanks for your reply, yes I have been using the updated version 2.3.1 and I checked the version of mscorwks.dll being loaded, v2.0. I stepped through the shim code and it appears that the error in loading is occurring at:

    IfFailGo( m_pAppDomain->CreateInstance(

           CComBSTR(L"ManagedAggregator, PublicKeyToken=d51fbf4dbc2f7f14"),

           CComBSTR(L"ManagedHelpers.ManagedAggregator"),

           &srpObjectHandle) );

    In the CLRLoader.cpp. The debug output at this point:

    First-chance exception at 0x7c812a5b in EXCEL.EXE: Microsoft C++ exception: EEFileLoadException at memory location 0x0013c030..

    First-chance exception at 0x7c812a5b in EXCEL.EXE: Microsoft C++ exception: [rethrow] at memory location 0x00000000..

    First-chance exception at 0x7c812a5b in EXCEL.EXE: Microsoft C++ exception: [rethrow] at memory location 0x00000000..

    First-chance exception at 0x7c812a5b in EXCEL.EXE: 0xE0434F4D: 0xe0434f4d.

  37. andreww says:

    bowman – not trying to be funny here, but are you sure that its v2.0 of mscorwks.dll (not just mscoree.dll)?

    The reason I ask is that I have a strong suspicion that this is the CLR-lockback mechanism at work here.

    mscoree 2.0 (shipped with CLR 2.0) locks the Excel process back to 1.1 if it doesn’t find a patched version of otkloadr.dll on the machine. This dll is only installed with Office 2003 + later, so you probably don’t have it at all on your Office 2000 machine.

  38. bowman says:

    Andrew,

    No worries, I need someone to keep me honest. Yes I am sure that v2.0 is loading. I can see it in the debug output as Excel is loading as well as the process explorer showing v2.0. I think I might have confused you a bit. I am not running this on a machine with Office 2000. My development machine is Office 2003/VS 2005. I  took the files I needed to import off of an Office 2000 machine only to create the Excel 9 libraries. So with my addin setup, I have set references to my imported libraries and written my code to those (assuming forward compatibility). When shimmed – no go, when not shimmed it’s ok. It’s also ok when I change the references to the 2003 PIA.  

  39. Fabian says:

    Andrew,

    I’ve created an Oulook-AddIn with VS 2008. On the machine on which I created the AddIn everything works fine (Outlook 2007). On another PC with Outlook 2003 and a Visual Studio installed it works too. But on all other PCs with Outlook 2003 an error message occures "Realease called on a Pointer that has already been released". The same error which Joe had. I tried everything which seems to help Joe but nothing solves my error.

    Perhaps I made some mistakes by referencing the necessary dlls – I don’t know.

    Thanks!

  40. andreww says:

    Fabian – please provide more information: is this a VSTO add-in, a shimmed shared add-in, an unshimmed shared add-in, or a native add-in? If managed, do you have the correct version of the PIAs installed on the failing machines? If VSTO, do you have the correct version of the VSTO runtime on these machines? Does your setup include all dependent DLLs?

  41. andreww says:

    bowman – this is intriguing. The behavior without a shim is extremely simple – there are fewer moving parts, so it’s probably bypassing the problem. In the shimmed case, it’s interesting that it works with the 2003 PIAs but not with the 2000 IAs. Since you are building on a 2003 box, are you sure that you’re not inadvertently building in a dependency on the 2003 PIAs?

    The shim itself (including the ManagedAggregator) does not have a dependency on Office at all. Its only dependencies are mscoree, mscorlib and msaddndr (for IDTExtensibility2), none of which has any dependency on Office either.

    Another avenue to explore: does it work with the shim on an Office 2000 box, with the 2000 IAs?

  42. Fabian says:

    Andrew,

    OK, I am new in developing add in’s so I’m sorry!

    It is a shared Add-In and the shim-Project has been added. You wrote "if managed" – I don’t know if its managed – what does it mean? I added references for the office.dll and the office.interop.outlook.dll. In the setup project I added the main dll, the managedAggregator.dll, the extensibility.dll and the shim-dll. When I run the setup the following files are in the destination folder: Extensibility.dll, managedAggregator.dll, office.interop..dll, office.dll, main.dll and the mainShim.dll.

    Is that enough? ‘The Shim.dll is registered correctly, I think! But the error message appears..

    Thank you for helping me!

  43. andreww says:

    Fabian – the fact that it works on machines with VS installed suggests that you’re missing either the PIAs or the VSTO runtime on the failing machines. Can you confirm that these are correctly installed on the failing machines?

  44. Fabian says:

    Andrew – I installed the 2003 PIAs on the failing machine but it still doesn’t work. I download them from the Microsoft Website. Perhaps it is the Extensibility.dll? But how can I ensure that the necessary dll’s are installed? I’ve got no ideas anymore.. thanks!

  45. andreww says:

    Fabian – from your list, it looks like you do have all the required DLLs in your setup package. The next question is, are they correctly registered (where required)? The registration requirements are specified in the covering article for the shim wizards. Please check these first.

    Then, if the problem persists, you need to debug into the shim/add-in on the failing machines. At the least, you should post the full stack report when the exception is thrown.

  46. Kumar says:

    Any help you can offer is appreciated.  I use Visual Studio 2008 and Excel 2007. I have a Excel VSTO addin and an RTD server built in VB.net. I need RTD server code to be able to call VSTO add in at run time.

    I realized that VSTO addin is loaded into  its own app domain. RTD server runs on the default app domain.  How can I get these tow loaded to the same app domain.

  47. Stephan says:

    Andrew – this is a great blog and very helpful. Thanks.

    I have couple of questions.

    1. I have an RTD and automation add in. When I update my assemblies (code changes) do I need to rebuild and deploy the shim(s)?
    2. I have two seperate shim projects for these created using the Shim wizard. When I run my application, these assemblies get loaded into seperate application domains. Is there a way I can get these to load into same domain?

    3. Is it possible to use shadowCopy functionality? I tried to  plug in the code in the generated file(CLRLoad). Looks like msrcorlib.tlh doesn’t have number of apis  for _AppDomain class. For example, I can see in MSDN that AppDomain should have SetShadowCopyFiles(), but I don’t see it in my local copy. Any thoughts?

    Your help is much appreciated.

  48. andreww says:

    Stephan – thanks for your feedback. Regarding your questions:

    1. The only code that is specific to a specific add-in/RTD/etc is the code in ConnectProxy.cpp that specifies the component to load, that is:

    static LPCWSTR szAddInAssemblyName =

    L"TestAddin, PublicKeyToken=ddf2e0af5633d44c";
    

    static LPCWSTR szConnectClassName =

    L"TestAddin.Connect";
    

    static LPCWSTR szAssemblyConfigName =

    L"TestAddin.dll.config";
    

    …so, if you don’t change any of these when you update your assemblies, then you don’t need to change the shim.

    1. If you think of the load sequence (Office loads the shim, then the shim creates the AD and loads the managed assembly), you’ll realize that Office WILL load a separate shim DLL for each extension. I suppose it’s possible to modify the shim code to retrieve the IAppDomain* from CreateDomainEx, and expose that through an automation object you expose through the COMAddIns collection. Then, you could get to this from any external component, but I haven’t tried this specific use of the technique.

    2. SetShadowCopyFiles is deprecated. You should use IAppDomainSetup::ShadowCopyFiles instead. In my mscorlib.tlh I see this at about line 3517.

  49. Double_B says:

    Hello.

    I have one problem. I have COM add-in shim and when i make security on high, then can’t press enable.

    Sombody now what is wrong?

    Thank you.

  50. andreww says:

    Double_B – you haven’t provided much information here. If you’re using Office 2003, please see this article: http://msdn.microsoft.com/en-us/library/aa195576.aspx.

    If you’re using Office 2007, please see this article: http://technet.microsoft.com/en-us/library/cc179050.aspx

  51. Double_B says:

    Yes i do in office 2003 and Visual Studio 2008. It was ok until i came to certifikat. Now i think that i have a problem whit one of the certifikat which is not sign. I have problem whit sam root certificat which it was on computer when i came to this computer. This is a test version of COM add-in shim. And this is my first work whit visual studio.

    Thank you!

  52. andreww says:

    Double_B – you’re still not providing enough information to figure out what your problem is. Please read up on digital signatures and the Office security levels for your version of office. See the links I gave you plus these: http://support.microsoft.com/kb/206637/

    http://msdn.microsoft.com/en-us/library/aa159893(office.11).aspx

    http://office.microsoft.com/en-us/ork2003/CH011466331033.aspx

  53. mailtorakib says:

    Hi Andrew,

    Thanks to you and Misha for your hard work.

    I am building a shared Add-in(tried VSTO first, but had to go back to shared) for Outlook using C# targeting Framework 2.0 and used the new Com Shim 2.3.1 with VS2008. My problem is similar to that of Fabian. The add-in works fine in my development PC having XP and Office 2003. It worked fine on a test PC with Office 2007. But it doesn’t load in other test machine having Office 2003. Extensibility.dll, microsoft.office.interop.outlook.dll, office.dll all are copied to installtion directory. I checked after enabling Fusion, that all assemblies are loading successfully. I installed PIA. But still it doesn’t load. When i check the "COM Add-ins" under "Tools -> Options -> Other -> Advanced Options", it says that "Not loaded. A runtime error ocurred during the loading of COM add-in."

    Can you please tell me what should i do?

    Thanks

    Rakib Hasan

  54. andreww says:

    Rakib – First, you should run AddInSpy to see if it can identify the problem: http://code.msdn.microsoft.com/AddInSpy

    Next, you should debug your add-in. Put breakpoints at the beginning of all the IDTExtensibility2 methods in both your add-in and the shim.

    Also, identify the differences between the machines where it works and the one where it doesn’t: OS version, Office version, PIA versions, .NET CLR versions, etc.

    Check to see if the add-in is getting blacklisted (see AddInSpy).

    Also check to see if the add-in loads without the shim.

  55. mailtorakib says:

    Hi Andrew,

    Thanks for your reply. I checked everything. Add-in didn’t work with/without the shim.

    I have found the cause and the solution. Though i was copying Extensibility.dll to the installation directory, but the add-in needs it in GAC. So, after installing extensibilityMSM.msi, add-in loads without any problem.

    Thanks

    Rakib Hasan