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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
DataBreaches.Net
腾讯CDC
GbyAI
GbyAI
I
InfoQ
博客园 - Franky
G
Google Developers Blog
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
Vercel News
Vercel News
博客园_首页
MyScale Blog
MyScale Blog
Martin Fowler
Martin Fowler
N
Netflix TechBlog - Medium
V
V2EX
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog

博客园 - 挖土.

学笛子 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()