如何从EXE调用VSTO生成的插件(DLL) [英] How can I call the VSTO generated addin(DLL) from an EXE

查看:417
本文介绍了如何从EXE调用VSTO生成的插件(DLL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我创建了一个VSTO Word Addin。它生成了一个DLL文件。我不想将其部署为EXE。但我想使用C#应用程序(EXE)来调用或调用此VSTO DLL。这可能吗?如果可能,我该如何实现?



请注意,我不想将我的Addin部署为EXE。我只希望我的VSTO插件保留为DLL,然后从EXE调用。



我尝试了以下方法但没有运气。



Hi,

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);



这里WordAddin是VSTO dll。




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 the 'No parameterless constructor defined for this object.' in this case.

Unable to go further!. Kindly suggest.

推荐答案

这篇关于如何从EXE调用VSTO生成的插件(DLL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆