簡體   English   中英

MVC 3文件,新項目中的程序包管理器控制台中的NuGet錯誤

[英]NuGet errors in Package Manager Console on MVC 3 File, New Project

所以我安裝了新的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:由於以下驗證異常而跳過了文件:文件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未經過數字簽名。 該腳本不會在系統上執行。 有關詳細信息,請參閱“get-help about_signing”...

因此,這里出現兩個錯誤,一個是在嘗試加載擴展數據文件時,另一個是在加載格式數據文件時。

我已經安裝了powershell 2.0。 有人有主意嗎? 我是否應該關心項目是否成功創建(我認為)?

你是怎么安裝NuGet的?

我只是因為我提取了一個Powershell模塊而沒有在解壓縮之前單擊zip文件屬性中的“Unblock”而導致類似錯誤。 這意味着所有文件都被標記為來自互聯網,而RemoteSigned將不允許運行未簽名的遠程文件。

導航到包含所提及文件的文件夾,然后打開它們的“屬性”對話框,並查看是否顯示“此文件來自Internet”的消息,並顯示“取消阻止”按鈕。 如果是這樣,請為每個文件單擊它,然后重試。

出於某種原因,我經常遇到類似的問題。 所有NuGet文件都已解鎖,只需重新啟動VS(通過打開sln文件)就無法修復它。 什么是自行打開Visual Studio,無需加載解決方案,然后打開包管理器控制台, 然后打開解決方案。

這個錯誤對我來說是由.Net Reflector(免費版)引起的。 使用Addin Manager禁用它,我很好。

我有同樣的錯誤! 我的解決方案非常簡單。 只需右鍵單擊Visual Studio,然后在嘗試打開解決方案時選擇“以管理員身份運行”。

我相信您需要以管理員身份運行Visual Studio。

在Package Manager控制台中,您可以檢查Powershell的執行策略。 輸入“get-executionpolicy”。 默認情況下它將是“RemoteSigned”之類的值。 MvcScaffolding已簽署,因此它將在此政策下運行。

這是一個包含更多信息的網址: http//technet.microsoft.com/en-us/library/dd347649.aspx

以下是記錄的各種執行策略: http//technet.microsoft.com/en-us/library/dd347628.aspx

以下是第一個鏈接的摘錄:如果您嘗試運行下載的腳本,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.

希望有所幫助。

您可能只想將Powershell執行策略更改為不受限制。 請參閱此Microsoft知識庫文章KB 2411920

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM