使用 PowerShell 运行我的第三方 DLL 文件
我不确定这对于 PowerShell 是否可行。
但基本上我有一个 Windows Forms 程序,它配置一个名为 EO Server 的程序。 EO 服务器有一个 API,我引用 EOServerAPI.dll 来运行以下代码。
using EOserverAPI;
...
private void myButton_Click(object sender, EventArgs e)
{
String MDSConnString="Data Source=MSI;Initial Catalog=EOMDS;Integrated Security=True;";
//Create the connection
IEOMDSAPI myEOMDSAPI = EOMDSAPI.Create(MDSConnString);
//Get JobID
Guid myMasterJobID = myEOMDSAPI.GetJobID("myJobRocks");
}
是否可以与 API DLL 文件交互并进行与 Windows 窗体应用程序中相同类型的调用?
I am not sure if this is possible or not with PowerShell.
But basically I have a Windows Forms program that configures a program called EO Server. The EO Server has an API, and I make a reference to EOServerAPI.dll to make the following code run.
using EOserverAPI;
...
private void myButton_Click(object sender, EventArgs e)
{
String MDSConnString="Data Source=MSI;Initial Catalog=EOMDS;Integrated Security=True;";
//Create the connection
IEOMDSAPI myEOMDSAPI = EOMDSAPI.Create(MDSConnString);
//Get JobID
Guid myMasterJobID = myEOMDSAPI.GetJobID("myJobRocks");
}
Is it possible to interact with an API DLL file and make the same types of calls as you would in a Windows Forms application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,您可以:
您可以像这样调用静态方法:
除了 Add-Type,您还可以使用反射:(
请注意,即使上面也调用了 Reflection 库和 LoadFile 静态方法。)
Yes, you can:
You call a static method like so:
Instead of Add-Type, you can also use reflection:
(Note that even the above is calling the Reflection library and the LoadFile static method.)
查看博客文章从 PowerShell 加载自定义 DLL。如果您可以与 .NET 中的对象交互,那么您也可以在 PowerShell 中进行交互。
Take a look at the blog post Load a Custom DLL from PowerShell. If you can interact with an object in .NET, you can probably do it in PowerShell too.
实际上,其他提供的解决方案对我不起作用,这里有一个非常适合我的替代方案:
Actually the other offered solutions don't work for me, here it's an alternative that works perfectly for me:
时间:2019-03-07 标签: c#dllinfo
.获取命名空间和类,
如果它不是“可执行”dll(获取/设置 dll 的东西),那么这是我所知道的最好的(与创建示例 dll 相比不需要):
https://kazunposh.wordpress.com/2012/03/19/проверка-корректного-ввода-distinguished-name-в-скри/
c# dll
info. get namespace&classes
if it's not "executable" dll (something get/set dll) then this is the best that i know (not needed vs for sample dll creating):
https://kazunposh.wordpress.com/2012/03/19/проверка-корректного-ввода-distinguished-name-в-скри/