4

所以我安装了新的 MVC3 工具更新并尝试创建一个新的 MVC3 Web 应用程序。该项目报告为已成功创建,但如果我打开包管理器控制台,我会看到以下内容......

加载扩展类型数据文件时出现以下错误:D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Types。 ps1xml :由于以下验证异常而跳过文件:File D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Types.ps1xml无法加载。文件 D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Types.ps1xml 未进行数字签名。该脚本不会在系统上执行。请参阅“get-help about_signing”了解更多详细信息...加载格式数据文件时出错:D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Format.ps1xml, , D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Format.ps1xml :由于以下验证异常而跳过文件:文件 D:\Program Files (x86)\Microsoft Visual Studio 10.0 \Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Format.ps1xml 无法加载。文件 D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Format.ps1xml 未进行数字签名。该脚本不会在系统上执行。请参阅“获取关于签名的帮助”

所以这里似乎出现了两个错误,一个是在尝试加载扩展数据文件时,一个是在加载格式数据文件时。

我已经安装了powershell 2.0。有人有想法么?我应该关心项目是否成功创建(我认为)?

4

6 回答 6

3

你是如何安装 NuGet 的?

我只是在与一个类似的错误搏斗,这是因为我在提取之前没有先在 zip 文件的属性中单击“取消阻止”就提取了一个 Powershell 模块。这意味着所有文件都被标记为来自互联网,并且 RemoteSigned 不允许运行未签名的远程文件。

导航到包含上述文件的文件夹,然后打开它们的“属性”对话框,查看是否有一条消息显示“此文件来自互联网”并带有“取消阻止”按钮。如果是这样,请为每个文件单击它,然后重试。

于 2011-04-27T17:09:01.983 回答
2

出于某种原因,我经常遇到类似的问题。所有 NuGet 文件均已解锁,仅重新启动 VS(通过打开 sln 文件)并不能修复它。什么是自己打开 Visual Studio,不加载解决方案,然后打开包管理器控制台,然后打开解决方案。

于 2011-06-16T18:59:34.550 回答
0

这个错误对我来说是由.Net Reflector(免费版)引起的。使用插件管理器禁用它,我很好。

于 2011-07-11T21:19:17.960 回答
0

我有同样的错误!我的解决方案非常简单。当您尝试打开解决方案时,只需右键单击 Visual Studio 并选择“以管理员身份运行”。

于 2011-08-12T15:18:05.210 回答
0

我相信您需要以管理员身份运行 Visual Studio。

在 Package Manager 控制台中,您可以查看 Powershell 的执行策略。键入“获取执行策略”。默认情况下,它将是一个类似于“RemoteSigned”的值。MvcScaffolding 已签名,因此它将在此策略下运行。

这是一个包含更多信息的网址: http ://technet.microsoft.com/en-us/library/dd347649.aspx

以下是记录的各种执行策略: http ://technet.microsoft.com/en-us/library/dd347628.aspx

以下是 torm 第一个链接的摘录:如果您尝试运行下载的脚本,Windows PowerShell 会显示以下错误消息:

    The file <file-name> cannot be loaded. The file 
    <file-name> is not digitally signed. The script
    will not execute on the system. Please see "Get-Help
    about_signing" for more details.

Before you run the script, review the code to be sure that you trust it.
Scripts have the same effect as any executable program.

To run an unsigned script:

    1. Save the script file on your computer. 
    2. Click Start, click My Computer, and locate the saved script file. 
    3. Right-click the script file, and then click Properties. 
    4. Click Unblock.

If a script that was downloaded from the Internet is digitally signed, but
you have not yet chosen to trust its publisher, Windows PowerShell displays
the following message:

    Do you want to run software from this untrusted publisher? 
    The file <file-name> is published by CN=<publisher-name>. This 
    publisher is not trusted on your system. Only run scripts
    from trusted publishers.

    [V] Never run  [D] Do not run  [R] Run once  [A] Always run  
    [?] Help (default is "D"):

    If you trust the publisher, select "Run once" or "Always run." 
    If you do not trust the publisher, select either "Never run" or 
    "Do not run." If you select "Never run" or "Always run," Windows
    PowerShell will not prompt you again for this publisher.

希望有帮助。

于 2011-11-16T20:11:35.350 回答
0

您可能只想将 Powershell 执行策略更改为不受限制。请参阅此 Microsoft 知识库文章KB 2411920

于 2012-02-27T21:27:21.687 回答