index > Visual Studio Tools for Office > COM Shims

COM Shims

I am new to creating COM Shims. I want to know for which all asseblies other then Office Extensions that we can create COM Shims.

How is it implemented in Application Packaging and how can we find out which assembly requires COM Shim to be created.
Sudhir Kumar
Sudhir,

I am a little bit lost. I assume you are talking about the technique outlined here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/ODC_Office_COM_Shim_Wizards.asp

I am not clear what your question is though? Do you understand why shims are needed?


Misha (VSTO team is hiring. We would like to hear from you http://tinyurl.com/ZQGW2)
Misha Shneerson
Yes It is the same COM Shims that Microsoft advices for Office Addins.

But what I want to Know as a Application Packager that

If  I get a application with office addins we can apply COM Shim to the addin DLL. But what to do if the DLL is not a strong DLL. How can we convert the DLL to strong DLL without the source code.

Can this COM Shim technology be used for some other application DLLs. If yes How and If not Why.

In any case way can't we use in terms of conflict resolution technique.
Sudhir Kumar
I am not aware of a simple way to strong name an assembly that has not been previously delay signed. Keep in mind all assemblies referenced by strong named assemblies must be strong named as well. If there are no other unsigned assemblies referenced then you can first run ildasm tool to retrieve the MSIL code and then compile it back into an assembly using ilasm this time by specifying a key pair.

However you might choose not to do this. It still not the end of the world and I would still recommend using the COM shim - just without the strong name. This will at least place your assembly into a separate AppDomain and give you types isolation. There are some remote security risks associated with using unsigned assemblies and you need to assess the risks before going down this road.

To achieve loading unsigned assemblies you need to make minor modification to the code of the COM shim. In the below snippet from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_shim.asp you will just need to remove the specification of the PublicKeyToken.

static LPCWSTR szAddInAssemblyName = L"ManagedAddIn, PublicKeyToken=6c96c7507b8e2be8"; 
static LPCWSTR szAddInAssemblyName = L"ManagedAddIn";
static LPCWSTR szConnectClassName = L"ManagedAddIn.Connect";
LPCWSTR ShimConfig::AssemblyName()
{
return szAddInAssemblyName;
}
LPCWSTR ShimConfig::ConnectClassName()
{
return szConnectClassName;
}



Misha (VSTO team is hiring. We would like to hear from you http://tinyurl.com/ZQGW2)
Misha Shneerson
Thankyou Misha

It was really helpful to me.
Hope u will guide me in the same way in furture too.

regards
Sudhir kaushik
Sudhir Kumar
reply 5

You can use google to search for other answers

 

More Articles

• Bug in VSTO/Word? Backspacing doesnt deletes a node
• Can't restore database in hands on lab
• Excel errors
• Namespace URI URN - what shall I use?
• open a .pps in a .net form
• Creating Rich Reports in MS Word
• XMLNodes Confusion
• Auto-reply including original message
• Freeze Pane in VSTO2005
• Error occurred when undo (Ctrl+Z) operation done
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Word2007 Add-In: Can I customize the Wor
• Problem deploying .Net COM Add-In
• Filling data islands on servers
• populate docvariables
• Serious: Update multiples tables of Data
• Dynamic Word Doc based on Params passed.
• Unit testing a .NET app hosted within Of
• Bookmarks in existing Word document form
• Migration of VBA code to VSTO
• Problem with punctuation after a control
• How can I add a CommandBarButton to &quo
• Working with Microsoft Excel
• Ability to lock worksheet
• Drag and Drop with VSTO2
• Can a WebBrowser control be used in an E

Hot Articles

• Working with Excel Pivot Tables
• problem with MS Word Add-In
• Two Questions : OnAction & LoadPicture
• Excel Question
• display image in listobject
• Problem when opening another excel file
• WebView no longer works in OL2007 in a s
• Working with OffLine SQL Server Data in
• Drag and Drop from Actions Pane to Docum
• Using VSTO: Outlook how to Programmatica
• .NET controls or WPF inside outlook form
• Create manual and automated tests for VS
• Assembly * cound not be found
• Why does CustomTaskPane.Window return an
• Add VSTORuntime and PIA to the bootstrap

Recommend Articles

• Issues inserting table inside bookmark
• multiple windows
• data from query result to excel graph/ch
• outlook add-in 2002 vs 2003
• VSTO for Excel Deployment kit
• Autosave
• Problem while try to close Excel File Fr
• Installation VST 2005
• How does OWC use a XML formated OLAP cub
• working with different office and word o
• Serious Error with Action Pane/User Cont
• deleting CustomDocumentProperties
• Outlook saves my mail to drafts instead
• Cells.NumberFormat - not standart (from
• Capturing Out of office event in Outlook