问题描述
我想使用 Powershell 编写一些实用程序,利用我们自己的 .NET 组件来处理实际工作.这代替了编写一个小型控制台应用程序来将调用联系在一起.我的问题是,我在哪里可以找到很好的文档或教程资料来帮助我快速完成这项工作?
I want to use Powershell to write some utilities, leveraging our own .NET components to handle the actual work. This is in place of writing a small console app to tie the calls together. My question is where I would find a good source of documentation or tutorial material to help me fast track this?
推荐答案
如果要将程序集加载到 PowerShell 会话中,可以使用反射并加载程序集.
If you want to load an assembly into your PowerShell session, you can use reflection and load the assembly.
[void][System.Reflection.Assembly]::LoadFrom(PathToYourAssembly)
加载程序集后,您可以调用静态方法并创建类的新实例.
After you load your assembly, you can call static methods and create new instances of a class.
可以找到一个很好的教程 这里.
A good tutorial can be found here.
EBGreen 提到的两本书都很优秀.PowerShell Cookbook 非常面向任务,PowerShell in Action 很好地描述了该语言、它的重点和可用性.PowerShell in Action 是我最喜欢的书之一.:)
Both books mentioned by EBGreen are excellent. The PowerShell Cookbook is very task oriented and PowerShell in Action is a great description of the language, its focus and useability. PowerShell in Action is one of my favorite books. :)
这篇关于从 Powershell 访问 .NET 组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!