Many of you are likely to have encountered the phrase DLL Hell in the glory days of the COM technology. Of course, with the arrival of the .NET era, developers got rid of this headache. But even these days COM is actively used in many applications. Our Outlook Security Manager is a vivid example of the COM technology usage in respect to applications, or add-ins; as you probably know, Outlook Security Manager must be registered as a COM component on the end-user’s PC. This adds some problems to the process of including your add-in in the installer since you need to write pertaining information to the Windows registry during the installation. The Reg Free COM technology allows you to avoid such necessity by using the manifest file in the xml format. In this way the installation of your application becomes much simpler. Before using Reg Free COM in your application, I’d recommend that you learn more about the technology from MSDN Magazine, April 2005 and MSDN library’s article.
In this post (as you probably guessed from the title :), I will tell you how to use Outlook Security Manager in a simple .net add-in that we will deploy later using the ClickOnce installer. So, here goes! I hope you have the Security Manager installed on your development pc. The programming language does not matter at all, I’m not going to write a single line of code ;-)
How to deploy Outlook Security Manager using Reg Free COM step-by-step
1. Create a simple .net add-in for any host app.
2. Go to the References folder of your project and add the following COM reference: secman.dll. See the COM tab of the Add References dialog in Visual Studio.
3. Select the newly added reference and set the Isolated property to true. Please note that the Isolated property is the key point in using the Reg Free COM technology.
4. Build the project. Oops… it was not successful… The cause of the issue lies in the adxloader.dll.manifest file. Exclude it temporarily from the project and try building the project again.
5. After the compilation process finishes you can find the manifest file in the output folder. The name of the newly generated manifest file is in the following format *.manifest (don’t confuse it with adxloader.dll.manifest ;-).
6. You can remove the secman.dll reference now. But don’t delete the manifest file itself. Also, you need to add the adxloader.dll.manifest file to the project, hope the manifest file wasn’t deleted completely.
7. Now you can add the Security Manager component to the add-in module.
8. Set the Copy Local property to true.
9. Now you can build a ClickOnce installer. Don’t forget to include the secman.dll and its manifest that was generated earlier. You also need to include the SecurityManager.2005.dll in the installer.
Now you can test the ClickOnce installer on a blank machine without Outlook Security Manager installed. Remember, Reg Free COM works starting with Windows XP and higher.
I believe you have already asked yourself – why there is no single line of code in the add-in that uses Security Manager. The reason is simple – Outlook Security Manger is the component that you add to the add-in module, at that the component’s constructor is added automatically. And actually, nothing else is needed to check the operability of Reg Free COM. You can make sure of this by removing the manifest file for secman.dll.





6 Comments
Hi,
good article. This works fine for WinXP as a client. Did you already try this for Win7 as a Client? I can’t get it to work under Win 7.
Seba
Hi Sebastian,
Yes, I did test it on Windows 7. It works as expected, I didn’t notice anything strange. Did you try either of the sample projects that I provided with the article?
Hi Eugene,
do I have to do this AddinLoader thing also if I onyl use Addin Express Outlook Security Manager???
Hi Sebastian,
Sorry, I don’t quite understand you. What AddinLoader do you mean?
In your sample project. There is a adxloader.dll. Do I need this if I want to deploy a WinForms Application with ClickOnce?
No, you don’t need that file since you don’t distribute an add-in.