28

I'm trying to develop an MS Office Addin in C# .Net and I don't have access to Visual Studio. Instead I'm using SharpDevelop as my IDE, (but my question is equally relevant to anyone developing using any other IDE or compiling from the command line...)

I've done a bit of searching for guides on how to develop AddIns, but they all seem to require Visual Studio and follow these steps:

  1. Install the Interop Assemblies
  2. Create a Visual Studio .Net Project (I'm unable to do this bit)
  3. Extend the VS ThisAddIn template

What I've managed to do is to:

  1. Install the Interop Assemblies
  2. Create a C# empty SharpDevelop project
  3. Add a GAC reference to Microsoft.Office.Interop.Outlook
  4. Add a COM reference to Microsoft Office 12.0 Object Library
  5. add the line using Outlook = Microsoft.Office.Interop.Outlook;
  6. and the line using Office = Microsoft.Office.Core;
  7. Look at some example code and realise that they all refer to VS templates and VSTO libraries (Microsoft.Office.Tools) which I don't have.

Where do I go from here? Is there a guide/tutorial I've missed, or can someone provide some pointers?

Iain Sproat
  • 5,210
  • 11
  • 48
  • 68
  • 2
    This looks like trying to eat soup with a fork, anyway you should be on the right track ... you could try MonoDevelop, it should be somewhat similar to VS but I have little experience with it – Alex Dec 07 '11 at 13:01
  • 1
    What I'm really after is an IDE independent way of creating a Microsoft Office AddIn using C#. So the choice of IDE shouldn't be a factor. – Iain Sproat Dec 07 '11 at 13:04
  • @sprocketonline - You do understand there nothing special about visual studio projects right? – Security Hound Dec 07 '11 at 13:14
  • @Ramhound Yes, but how do I get the Microsoft.Office.Tools libraries and where can I find some example code that doesn't rely on the ThisAddIn partial class that the Visual Studio template creates? – Iain Sproat Dec 07 '11 at 13:22
  • If there's a way to install Microsoft.Office.Tools and somewhere I can copy the template generated code from without having Visual Studio (and doesn't violate any licenses), that may be a solution.... – Iain Sproat Dec 07 '11 at 13:42

2 Answers2

20

NetOffice (http://netoffice.codeplex.com or https://osdn.net/projects/netoffice/) is a great set of version-independent interop assemblies for Office. This is all you need to make add-ins using SharpDevelop, and the project has a bunch of tutorials and samples too, including some for Outlook.

If you're making an add-in for Excel using Excel-DNA (which you need to expose user-defined worksheet functions from .NET), NetOffice still gives you a complementary set of libraries for accessing the Excel COM automation interfaces from your Excel-DNA add-in, so they work together well.

For both NetOffice and Excel-DNA, you'll also be able to use the free Visual Studio Express editions (with some small tricks needed to get debugging working). Visual Studio Express does not include VSTO at all. SharpDevelop also has many more features than the Express editions, like built-in refactoring and VB.NET <-> C# translation tools, so there are good reasons to prefer SharpDevelop as your free IDE.

Chris
  • 3,400
  • 1
  • 27
  • 41
Govert
  • 16,387
  • 4
  • 60
  • 70
  • NetOffice looks fantastic. Wish I had seen this before starting with Visual STudio, but still not too late to switch to Sharp Develop :D – giorgio79 Dec 29 '11 at 13:58
  • 1
    NetOffice is just a collection of .NET libraries you use instead of the special VSTO libraries or the Office interop assemblies. You can use it perfectly well with Visual Studio or SharpDevelop. – Govert Dec 29 '11 at 15:45
0

EDIT: I missed the reference to Outlook, my apolgies.

For Outlook, look here. Outlook Redemption is useful.

I'm not a Word Expert, but there are plenty of tutorials on the web.

For Excel I'd suggest you actually look at ExcelDNA

Plenty of SO questions on this topic. See Exposing .net methods as Excel functions? for example as additional advice on where to start and what your options are.

Community
  • 1
  • 1
dash
  • 89,546
  • 4
  • 51
  • 71