问题描述
每当我创建一个新的MVC项目时,我收到一个错误 - 无法初始化Powershell主机,用于实体框架和Jquery。
错误:
以下软件包无法从'C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Packages'
Whenever I create a new MVC project, I am getting an error - failed to initialize Powershell host, for the entity framework and Jquery.The error:The following packages failed to install from 'C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Packages'
EntityFramework.5.0.0:无法初始化Powershell主机。如果您的PowerShell执行策略设置设置为AllSigned,请打开软件包管理器控制台以初始化主机。
EntityFramework.5.0.0: Failed to initialize the Powershell host. If your powershell execution policy setting is set to AllSigned, open the package manager console to initialize the host first.
jQuery.1.7.1.1:无法初始化Powershell主机。如果您的powershell执行策略设置设置为AllSigned,请打开包管理器控制台以初始化主机。
jQuery.1.7.1.1: Failed to initialize the Powershell host. If your powershell execution policy setting is set to AllSigned, open the package manager console to initialize the host first.
我可以删除Entity Framework参考,并手动添加,这是一个很好的解决方法,但它是烦人的,并且在某处有一些问题的迹象。任何想法在哪里看?
I can remove the Entity Framework reference, and add it manually, which is a good workaround, but it is annoying and a sign of some problem somewhere. Any ideas where to look?
此链接记录了类似的问题和解决方法:
This link documents a similar problem and workaround:http://social.msdn.microsoft.com/Forums/en/vssetup/thread/c934fed4-e44e-4a06-9e3b-eccb9c8aa8d6
推荐答案
MSDN线程的其中一个回复为我工作。以管理员身份运行PowerShell,并运行以下命令:
One of the replies on the MSDN thread worked for me. Run PowerShell as an Administrator and run the following command:
Set-ExecutionPolicy AllSigned
请参阅来获取安全性影响。
See Using the Set-ExecutionPolicy Cmdlet for security implications.
这篇关于创建新的MVC项目 - EF和JQuery时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!