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

推荐订阅源

WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
MyScale Blog
MyScale Blog
雷峰网
雷峰网
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
V
V2EX
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
N
Netflix TechBlog - Medium
Vercel News
Vercel News
美团技术团队
人人都是产品经理
人人都是产品经理
The Cloudflare Blog

博客园 - 挖土.

学笛子 PowerShell: Try...Catch...Finally 实现方法 How to set the compuder to auto login 用 Powershell 安装Dotnet FrameWorrk 4.0 PowerShell 调用.netFramework中的静态函数 PowerGUI Visual Studio is now in beta! PowerShell 中定义和使用泛型 PowerShell 如何引用DLL 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 2.0 支持 DotNet FrameWork 4.0
挖土. · 2010-12-08 · via 博客园 - 挖土.

DotNet Framework 4.0 发布以后,你在 PowerShell 中执行引用 4.0 的 exe、dll,会报错,说你的Powershell的 dotnet framework 版本和你引用的 assemblis 不一致。这是因为默认PowerShell 的 Notdet FrameWork 版本是 v2.0, 我们需要让 PowserShell 支持 v4.0。


你只要创建一个 Powershell.exe.config 文件,在以下两个目录,就可以了。

  • C:\Windows\System32\WindowsPowerShell\v1.0
  • C:\Windows\SysWOW64\WindowsPowerShell\v1.0

1 <?xml version="1.0"?>
2 <configuration>
3     <startup useLegacyV2RuntimeActivationPolicy="true">
4         <supportedRuntime version="v4.0.30319"/>
5         <supportedRuntime version="v2.0.50727"/>
6     </startup>
7 </configuration>

 另外,也可以更改注册表, 把 RuntimeVersionv2.0.50727 改成  v4.0.30319。

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine