PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/CppOfficeManagedCOMAddInShim/ReadMe.txt

#
Plain Text | 124 lines | 89 code | 35 blank | 0 comment | 0 complexity | 5e1191d271aeaed76bd67abe970032d7 MD5 | raw file
  1=================================================================================
  2    Class Library APPLICATION : CppOfficeManagedCOMAddInShim Project Overview
  3=================================================================================
  4
  5/////////////////////////////////////////////////////////////////////////////
  6Overview:
  7
  8When we build a managed Office extension of any kind, we should ensure that
  9our extension is isolated from other extensions that might be loaded into 
 10the application. The standard way to isolate our extension is to build a 
 11custom COM shim by using the COM Shim Wizard, a set of Visual Studio project
 12wizards that helps you construct shims quickly and easily.
 13
 14
 15/////////////////////////////////////////////////////////////////////////////
 16Project Relation:
 17
 18CppOfficeManagedCOMAddInShim -> CSOfficeSharedAddIn
 19CppOfficeManagedCOMAddInShim shims the managed COM AddIn CSOfficeSharedAddIn
 20
 21ManagedAggregator -> CppOfficeManagedCOMAddInShim
 22ManagedAggregator loads and instantiates the add-in object, so that it can 
 23correctly aggregate this with the shim.
 24
 25
 26/////////////////////////////////////////////////////////////////////////////
 27Creation:
 28
 29Step1. Download the COM Shim Wizard template from the Microsoft download
 30site, and install it so we can find the Shim AddIn template in Visual Studio,
 31http://www.microsoft.com/downloads/details.aspx?FamilyId=3E43BF08-5008-4BB6-AA85-93C1D902470E&displaylang=en
 32
 33Step2. Create an Office COM Addin(Shared AddIn) to be shimed, and compile it. 
 34In this example, we use CSOfficeSharedAddIn as the target managed COM AddIn.
 35It's a good practice to sign the managed COM AddIn dll with strong name.
 36
 37Step3. Create a new project. In the New Project dialog, navigate to the 
 38Visual C++ / COMShims node. Select the AddIn Shim project in right panel, 
 39name it as CppOfficeManagedCOMAddInShim and click OK.
 40
 41Step4. The COM Shim Wizard pops up. In the first page of the wizard, specify 
 42the output assembly of the managed COM AddIn project, and press Next button. 
 43(We may receive a warning dialog saying that the assembly needs to be signed 
 44as strong name if the target assembly was not signed. Just click Yes to 
 45ignore it)
 46
 47Step5. The second page is for configuration when our AddIn implements a 
 48secondary extensibility interface. We do not need this in this sample. Just 
 49press Next
 50
 51Step6. The third page is about Shared Add-in Details. In the page we can 
 52specify:
 53
 54	Add-in Description
 55	Add-in Friendly Name
 56	Whether to load the Add-in when the host Office application starts
 57	Whether to install the Add-in to all users
 58	Add-in's host Office application
 59	
 60In this example, we check the Microsoft Word, Visio, Publisher, Project, 
 61PowerPoint, Outlook, FrontPage, Excel, and Access checkboxes and, press Next 
 62to go on.
 63
 64Step7. The last is a summary page. Click Finish to create the AddIn Shim 
 65project. Accompanied with CppOfficeManagedCOMAddInShim, the wizard creates a 
 66.NET class library project named ManagedAggregator. The generated project 
 67also includes a final build task that runs Regsvr32.exe on the target DLL to 
 68register the shim, so you do not need to register it manually. The final 
 69build task copies the ManagedAggregator.dll into the target folder for the 
 70shim. It also copies the managed add-in assembly that you specified into the 
 71target folder for the shim, along with the configuration file for the add-in. 
 72The project dependencies are set so that the ManagedAggregator is built first, 
 73before the shim. If you add a shim project to an existing add-in solution, 
 74you should adjust the build dependencies, as appropriate. 
 75
 76Step8. After the creation, compile the solution. You will find 
 77CSOfficeSharedAddIn in Office applications' COM Addins Dialog. And the 
 78location points to CppOfficeManagedCOMAddInShim.dll instead of mscoree.dll.
 79
 80
 81/////////////////////////////////////////////////////////////////////////////
 82Deployment:
 83
 84Step1. Navigate to the output folder of the CppOfficeManagedCOMAddInShim 
 85project. We can see the generated files:
 86
 87	CppOfficeManagedCOMAddInShim.dll
 88	ManagedAggregator.dll
 89	CSOfficeSharedAddIn.dll
 90
 91Step2. Copy the above three files to the target computer where you want to 
 92deploy the Add-in.
 93
 94Step3. On the target computer, start a command prompt as administrator.
 95
 96Step4. Enter the command "regsvr32 CppOfficeManagedCOMAddInShim.dll" to 
 97register the shim dll.
 98
 99Step5. Open an Office application to verify the AddIn is shimed by 
100CppOfficeManagedCOMAddInShim.dll.
101
102
103If you build a setup project for your add-in, you should add the primary 
104output of both the shim and the ManagedAggregator projects to your setup. You 
105should also change the value of the Register property for all three project 
106outputs. Set this to vsdrpCOM for the shim DLL, and vsdrpDoNotRegister for 
107both the original add-in DLL and the ManagedAggregator DLL. 
108
109
110/////////////////////////////////////////////////////////////////////////////
111References:
112
113MSDN: Isolating Microsoft Office Extensions with the COM Shim Wizard Version 
1142.3.1
115http://msdn.microsoft.com/en-us/library/bb508939.aspx
116
117COM Shim Wizard Author's blog:
118http://blogs.msdn.com/andreww/archive/2007/07/05/updated-com-shim-wizards.aspx
119
120COM Shim Wizard download page:
121http://www.microsoft.com/downloads/details.aspx?FamilyId=3E43BF08-5008-4BB6-AA85-93C1D902470E&displaylang=en
122
123
124/////////////////////////////////////////////////////////////////////////////