Creating new Add-in Express projects in Visual Studio .NET
We have been programming for Microsoft Office for a long time. Too long to describe in detail all solutions that can be built with our components as well as all pitfalls that you may run into when doing this. Maybe that’s why at first sight our Add-in Express doesn’t look so impressive as we wish. I think it’s high time for us to fix this drawback and start a series of articles on how to apply Add-in Express in practice. I will start from the simplest thing. But very important.
Creating a New Add-in Solution
Have you ever created add-in solutions based on Add-in Express? It is very easy. :-) Have a look at the Add-in Express Developer’s Guide available in All Programs \ Afalinasoft \ Add-in Express .NET. When creating a new solution you are to choose a programming language. I will create all examples in VB.NET, but you can convert them to C++, C# or J# (does anybody still use J#?) according to your preferences. By the way, soon we will have Chrome on the list.
The Shims
Also, you are to decide whether your project will be “shimmed”. In this case you will need to have C++ installed in your Visual Studio. If you are a novice in .NET and don’t know yet what is a shim, I will give a link a little below where you can find the complete information on the subject. Here I will tell you about shims in brief. The shim is a special Win32-DLL (called a wrapper, loader or proxy as you prefer) that loads your add-in. The main purpose of the shim is the possibility to sign it with a digital signature. Only then your add-in will be able to get into Trusted Publishers when the High security level is set in Office, and the Trust all installed add-ins and templates flag is unchecked.
The second destination of shims is Application Domain Isolation. All non-shimmed DLLs are loaded in the default application domain. It means your add-in may be damaged by a crash of another add-in. The shim allows you to avoid this since your add-in will be loaded into its own application domain. In general, I strongly recommend always including shims in your projects if you have C++ in your Visual Studio .NET. You can find more information about shims here.
When creating an add-in solution you may notice the Generate a new key pair to sign assembly with a strong name flag. I’m not going to explain you what it is since it is one of the key notions of .NET. I will just say that it is impossible to create a shimmed solution without signing it with a strong name. Read more about strong-named assemblies here.
However, please note you needn’t care about shims and strong names. Add-in Express generates shim projects automatically as well as signs your assemblies with a strong name. All this information is for your better understanding.