惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium
Y
Y Combinator Blog
B
Blog RSS Feed
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
L
LangChain Blog
IT之家
IT之家
F
Fortinet All Blogs
V
V2EX
C
Check Point Blog
The Cloudflare Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans

博客园 - 挖土.

学笛子 PowerShell: Try...Catch...Finally 实现方法 How to set the compuder to auto login 让 PowerShell 2.0 支持 DotNet FrameWork 4.0 用 Powershell 安装Dotnet FrameWorrk 4.0 PowerShell 调用.netFramework中的静态函数 PowerGUI Visual Studio is now in beta! PowerShell 中定义和使用泛型 PowerShell中Add-Content 和 Out-File 的区别 给string加几个扩展方法 加快 c++ Builder 5编译速度 Windows 7 下的 SUBST 命令 How to configure the BDE for Windows Vista/7 - 挖土. Linker problems with Borland builder SQL 中的中位值计算 Windows 7的“上帝模式” XML 序列化和反序列化详例代码 给存储过程传递一个表 VSIdeTesthost installation issue - 挖土.
PowerShell 如何引用DLL
挖土. · 2010-07-29 · via 博客园 - 挖土.

如果DLL是在Dotnet Framework基础上,Visual Studio编译出来的,可以按照如下方法在PowerShell中引用。

 1 #引入DLL
 2 [System.Reflection.Assembly]::LoadFrom('D:\Test\MCF.Infrastructure.DTS.dll') | Out-null
 3 [System.Reflection.Assembly]::LoadFrom('D:\MCF\MCF.Infra.dll') | Out-null
 4 
 5 #创建对象
 6 $log = new-object MCF.Infra.Logger
 7 $lib = new-object MCF.Infrastructure.DTS.DTSClientLib($log)
 8  
 9 #调用类库的方法
10 $status = $lib.GetJobStatus() 

因为在创建 DTSClientLib 对象时,可以传入 null,可以这样

1 #引入DLL
2 [System.Reflection.Assembly]::LoadFrom('D:\Test\MCF.Infrastructure.DTS.dll') | Out-null
3 
4 #创建对象
5 $lib = new-object MCF.Infrastructure.DTS.DTSClientLib @($null)
6 
7 #调用类库的方法
8 $status = $lib.GetJobStatus()