0

I have created a VSTO Word Addin. It has generated a DLL file. I don't want to deploy that as an EXE. But I want to use a C# application(EXE) to call or invoke this VSTO dll. Is this possible? If possible how do I implement?

Please note that I don't want to deploy my Addin as an EXE. I only want my VSTO addin to remain as a DLL and then to be called from an EXE.

I have tried the below approach with no luck.

1) WordAddIn.ThisAddIn addin = new WordAddIn.ThisAddIn(null, null);

Here the WordAddin is the VSTO dll.

2) Using Reflection
Assembly newAssembly = Assembly.LoadFile("C:...bin\\Debug\\WordAddin.dll");

Type[] types = newAssembly.GetExportedTypes();
Type entryType = newAssembly.GetType("ThisAddin");
object o = Activator.CreateInstance(types[0], true);

I get 'No parameterless constructor defined for this object.' in this case.

Unable to go further!. Kindly suggest.

Kiru
  • 3,489
  • 1
  • 25
  • 46
Guruprasad
  • 331
  • 1
  • 4
  • 10
  • Very hard to see the point, VSTO was designed to make it easy to write add-ins for Office programs. So that the Office program can use your code. If you want to write a class library that you call from your *own* EXE then there's just no point whatsoever in using VSTO. – Hans Passant Mar 12 '14 at 10:45

1 Answers1

0

VSTO is for purely for customizing MS Office via add-ins; there is no sane way to use this with your .Net exe. For extending your own .Net exe with add-ins see the following resources:

Community
  • 1
  • 1
Steve Jansen
  • 9,398
  • 2
  • 29
  • 34