开发者

How can 2 .net executables call functions on eachother?

if I have 2 seperate .net executables how would one exe cal开发者_JAVA技巧l functions on the other one?


.NET executables are still assemblies. From VS2008 onwards, it is trivial to add a reference to a .NET exe (in VS2005 you have to use command-line for this). So simply ensure that the target exe exposes some public classes and methods.


Use it:

Assembly ass = Assembly.LoadFile("pathtoYourExe");
Type myType = ass.getType ("Full name of type whose method you need to call");
myTypeName inst = (myTypeName) Activator.CreateInstance(myType);

But if you want to call methods of runnning application - use WCF or .NET remoting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜