我可以从PowerShell的访问我的自定义.NET类? [英] Can I access My Custom .NET Class from PowerShell?
本文介绍了我可以从PowerShell的访问我的自定义.NET类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几个问题和疑虑有关PowerShell和.NET类。
I have a couple of questions and doubts to regarding PowerShell and .NET Classes.
我试图写一个类'富',将调用REST Web服务和执行某些任务。如果我在GAC部署类,那么我可以从PowerShell的称呼呢?
I am trying to write a class 'foo' that will call Rest web service and perform some tasks. If I deploy the class in GAC then can I call it from PowerShell?
推荐答案
尝试:
ADD-TYPE -AssemblyName myassemblyname
或
[System.Reflection.Assembly]::LoadWithPartialName("myassemblyname")
访问方法/程序集的属性,你可以这样做:
to access method/properties of your assembly you can do this:
[myassemblyname]::mymethod()
[myassemblyname]::myproperty
这篇关于我可以从PowerShell的访问我的自定义.NET类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文