Visual Studio 2013/15 Nuget Errors on Console - "The module to process 'nuget.psm1', listed in field 'ModuleToProcess' of module manifest..."

StackOverflow https://stackoverflow.com/questions/23333057

Question

Opening up Nuget Console I receive the following error:

The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(32) : Error in type "System.Xml.XmlNode": Exception: Cannot create a code method because of the method format. The method should be public, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(44) : Error in type "System.Xml.XmlNodeList": Exception: Cannot create a code method because of the method format. The method should be public, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(87) : Error in type "System.DirectoryServices.PropertyValueCollection": Exception: Cannot create a code method because of the method format. The method should be public, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(353) : Error in type "System.DirectoryServices.DirectoryEntry": Exception: Cannot create a code method because of the method format. The method should be public, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(360) : Error in type "System.DirectoryServices.DirectoryEntry": Exception: Cannot create a code method because of the method format. The method should be public, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(372) : Error in type "System.IO.DirectoryInfo": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(399) : Error in type "System.IO.FileInfo": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2977) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2984) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2991) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2998) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3005) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3219) : Error in type "Microsoft.PowerShell.DeserializingTypeConverter": Type "Microsoft.PowerShell.DeserializingTypeConverter" should be a TypeConverter or an PSTypeConverter. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3648) : Error in type "System.Management.Automation.ParameterSetMetadata": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3733) : Error in type "System.Management.Automation.FormatViewDefinition": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject. The module to process 'nuget.psm1', listed in field 'ModuleToProcess' of module manifest 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\QIYNP3CN.X43\Modules\NuGet\NuGet.psd1' was not processed because no valid module was found in any module directory.

I can update some of the nuget packages but not Entity Framework and some other packages. With the latter I receive an error:

"...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."

I should add I have Windows 8.1 Pro 64 bit.

Was it helpful?

Solution

This explains how to resolve part of my issue (but no why it had happened): http://social.msdn.microsoft.com/Forums/en-US/0b20e64e-e35f-4d0e-91f1-aebcfda7ebf2/package-manager-console-failed-to-load?forum=visualstudiogeneral

So edit devenv.exe.config and add the following (you may not need the "runtime" nor "assemblyBinding" tags but you get the idea:

 <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Management.Automation" publicKeyToken="31bf3856ad364e35" />
            <publisherPolicy apply="no" />
          </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.Commands.Utility" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.ConsoleHost" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.Commands.Management" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.Security" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.PowerShell.Commands.Diagnostics" publicKeyToken="31bf3856ad364e35" />
          <publisherPolicy apply="no" />
        </dependentAssembly>
        </assemblyBinding>
    </runtime>

Now this resolves my issue of not being able to update NuGet packages. However I still see errors i.e.:

The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(32) : Error in type "System.Xml.XmlNode": Exception: Cannot create a code method because of the method format. The method should be public, static, and have one parameter of type PSObject.

Bottom line I must have screwed up my Windows 8.1 Pro permissions. I was trying to open up links within Visual Studio 2013 into Chrome so I installed Chrome as administrator... the rest is history.

If I had time I would reinstall Windows 8.1 but the aforementioned temp solution is just that... a temp solution.

I found no windows "fix" and no-one appears to have had the same issue.

Hope this sort of helps anyone else.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top