4
votes

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)?

6
If you open up a powershell prompt and run Get-ExecutionPolicy, what does it say? Do you see this error if you reset VS and create a new MVC app?davidfowl
Get-ExecutionPolicy reports RemoteSigned. Not a PS expert so not sure if that's good or bad. The good news is that apparently simply restarting VS (twice) did the trick. Must have been some odd file handle that wasn't releasing.JasonCoder

6 Answers

3
votes

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.

2
votes

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.

0
votes

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

0
votes

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.

0
votes

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.

0
votes

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