Visual Studio 2015中的ASP.NET [英] ASP.NET in Visual Studio 2015

查看:138
本文介绍了Visual Studio 2015中的ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Visual Studio 2015启动一个新的ASP.NET应用程序。


当我点击"New Project ..."时,


然后在选择"ASP.NET Web应用程序"之前选择"Visual C#"==>"Web",


我提供一个名称对于项目,然后单击< OK>。


我选择MVC模板。


我在消息窗口中收到以下内容:



" Microsoft Visual Studio


  &NBSP; &NBSP; &NBSP; &NBSP;包装安装错误


  &NBSP; &NBSP; &NBSP; &NBSP;无法将所有必需的包添加到项目中。 以下软件包无法从'C:\Program Files(x86)\ Microsrosoft ASP.NET \ ASPP.NET Web Stack 5 \Packages'安装:


  &NBSP; &NBSP; &NBSP; &NBSP; jQuery.1.10.2:无法初始化PowerShell主机。 如果您的PowerShell执行策略设置设置为AllSigned,请打开程序包管理器控制台以首先初始化主机。


Modernizr.2.6.2:无法初始化PowerShell主机。 如果您的PowerShell执行策略设置设置为AllSigned,请打开包管理器控制台以首先初始化主机。"



任何想法是什么缺少以及如何纠正这种情况将不胜感激。

解决方案

你好irsharp,



根据您的错误消息,请尝试使用这些解决方案:



  1. 在visual studio中打开包管理器控制台窗口
    (visual studio - View> Other Windows>包管理器控制台)
    ,它将初始化要使用的NuGet包的powershell执行上下文。
  2. 如果问题仍然存在,那么您可以关闭当前正在运行的所有Visual Studio实例,然后在管理员模式下打开
    Windows Powershell 窗口并触发以下命令:

     &NBSP;&N BSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; 设置-ExecutionPolicy的AllSigned


<强>


  &NBSP; &NBSP; 3.键入以确认 - 更改执行策略。再次打开visual studio项目并打开Package Manager Console,然后尝试再次测试它。


重要的是要注意Powershell会给你一个警告:


"执行策略有助于保护您免受不信任的脚本的侵害。更改执行策略可能会使您面临about_Execution_Policies帮助主题中描述的安全风险。是否要更改执行政策?


并且应该小心启用此功能,并应阅读有关安全风险的帮助主题中的更多信息。


此外,您可能必须更改不同版本的PowerShell的权限(32位和64位版本需要单独的权限)。



  • 64位的PowerShell路径:C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • 32位的PowerShell路径:C:\\ \\ windows \SysWOW64 \ WindowsPowerShell \v1.0 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ en-us / previous-versions / windows / it-pro / windows-powershell-1.0 / ee176961(v = technet.10)">
    两种颜色应该可以使用,请参考
    。这种螺纹:



    • Set-ExecutionPo licy RemoteSigned
    • Set-ExecutionPolicy Unrestricted


    向前看你的回复。


    最好的问候,


    可能


I am trying to start a new ASP.NET app using Visual Studio 2015.

When I click "New Project...",

I then select "Visual C#"==>"Web", before selecting "ASP.NET Web Application",

I supply a name for the project and click <OK>.

I select the MVC template.

I receive the following in a message window:

"Microsoft Visual Studio

          Package Installation Error

          Could not add all required packages to the project.  The following packages failed to install from 'C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Stack 5\Packages':

          jQuery.1.10.2 : 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.

Modernizr.2.6.2 : 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."

Any ideas what is missing and how to remedy this situation would be greatly appreciated.

解决方案

Hi irsharp,

Based on your error message, please have a try with those solutions:

  1. to open the Package Manager Console window in visual studio (visual studio - View > Other Windows > Package Manager Console), which will initialize the powershell execution context for NuGet packages to use.
  2. If the problem still persists then you can close all instance of Visual Studio currently running and then open up Windows Powershell window in administrator mode and fire following command:

                                         Set-ExecutionPolicy AllSigned

      3. Type Yes to confirm - change in execution policy. Open up the visual studio project again and keep the Package Manager Console open, then try to test it again.

It is important to note however that Powershell will give you a warning:

"The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution policy?"

And should be careful of enabling this feature and should read more information in the help topics about the security risks.

In addition, you might have to change the permissions on a different version of PowerShell (32-bit and 64-bit versions require separate permissions).

  • 64-bit PowerShell Path: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • 32-bit PowerShell Path: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

Also, BOTH of these should work and please refer to this thread:

  • Set-ExecutionPolicy RemoteSigned
  • Set-ExecutionPolicy Unrestricted

Looking forwards your reply.

Best Regards,

May


这篇关于Visual Studio 2015中的ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆