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

推荐订阅源

A
About on SuperTechFans
小众软件
小众软件
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
博客园 - 三生石上(FineUI控件)
博客园_首页
N
Netflix TechBlog - Medium
IT之家
IT之家
H
Help Net Security
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
罗磊的独立博客
T
Tailwind CSS Blog
F
Fortinet All Blogs
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
V
V2EX
量子位
云风的 BLOG
云风的 BLOG
爱范儿
爱范儿
博客园 - 司徒正美
The Cloudflare Blog
Engineering at Meta
Engineering at Meta

博客园 - 挖土.

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