简体   繁体   中英

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

So I installed the new MVC3 tooling update and attempted to create a new MVC3 web app. The project reports as being successfully created but if I bring up the Package Manager Console, I see the following...

The following error occurred while loading the extended type data 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 : File skipped because of the following validation exception: 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 cannot be loaded. The 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 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details... There were errors in loading the format data file: 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 : File skipped because of the following validation exception: File 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 cannot be loaded. The file 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 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details...

So it appears that there are two errors occurring here, one while trying to load the extended data file and one while loading a format data file.

I have installed powershell 2.0. Anyone have any ideas? Should I care if the project got created successfully (I think)?

How did you install NuGet?

I was just wrestling with a similar error that was caused because I extracted a Powershell module without first clicking "Unblock" in the properties of the zip file before extracting. This meant all the files were flagged as coming from the internet, and RemoteSigned won't allow unsigned remote files to be run.

Navigate to the folder that contains the files mentioned, and open the Properties dialog for them, and see if there's a message saying "This file came from the internet" with an "Unblock" button. If so, click it for each file, and then try again.

For some reason I frequently run into a similar issue. All NuGet files are unlocked, and just restarting VS (by opening the sln file) does not fix it. What does is opening up Visual Studio by itself, without loading the solution, then opening up the Package Manager Console, and then opening the solution.

This error for me was caused by .Net Reflector (free version). Used the Addin Manager to disable it and I'm fine.

I had same error! My solution was really simple. Just right click Visual Studio and select "Run as administrator" when you try to open your solution.

I believe you need to be running Visual Studio as administrator.

In Package Manager console, you can check Powershell's execution policy. Type "get-executionpolicy". It will be a value like "RemoteSigned" by default. MvcScaffolding is signed, so it will run under this policy.

Here is an Url with more info: http://technet.microsoft.com/en-us/library/dd347649.aspx

and here are the various execution policies documented: http://technet.microsoft.com/en-us/library/dd347628.aspx

Here is an excerpt from torm the first link: If you try to run a downloaded script, Windows PowerShell displays the following error message:

    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.

Hope that helps.

You may want to simply change the Powershell Execution Policy to unrestricted. See this Microsoft KB article KB 2411920 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM