2011-04-08 110 views
12

我有一個類似於反射器問題的問題,除了我沒有安裝Reflector插件,並且仍然無法啓動NuGet控制檯。我在Windows 7 Professional,VS 2010 SP1上運行。NuGet無法加載PowerShell

Nuget通過GUI工作正常,但是例如,我不能在沒有控制檯的情況下安裝* .vsdoc文件。

了以下錯誤:

The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2943) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type". 
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2950) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type". 
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2957) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type". 
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2964) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type". 
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2971) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type". 
The following error occurred while loading the extended type data file: , C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Types.ps1xml(9) : Error in type "System.__ComObject#{866311e6-c887-4143-9833-645f5b93f6f1}": Exception: Cannot convert the "NuGet.VisualStudio.ProjectExtensions" value of type "System.String" to type "System.Type". 
The following error occurred while loading the extended type data file: , C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.2.20325.9034\Scripts\NuGet.Types.ps1xml(33) : Error in type "Microsoft.VisualStudio.FSharp.ProjectSystem.Automation.OAProject": Exception: Cannot convert the "NuGet.VisualStudio.ProjectExtensions" value of type "System.String" to type "System.Type". 
System.Management.Automation.CmdletInvocationException: Could not load file or assembly 'Scripts\nuget.psm1' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) ---> System.IO.FileLoadException: Could not load file or assembly 'Scripts\nuget.psm1' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) ---> System.ArgumentException: Illegal characters in path. 
at System.IO.Path.CheckInvalidPathChars(String path) 
at System.IO.Path.Combine(String path1, String path2) 
at Microsoft.VisualStudio.Platform.VsAppDomainManager.<AssemblyPaths>d__1.MoveNext() 
at Microsoft.VisualStudio.Platform.VsAppDomainManager.InnerResolveHandler(String name) 
at Microsoft.VisualStudio.Platform.VsAppDomainManager.ResolveHandler(Object sender, ResolveEventArgs args) 
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName) 
--- End of inner exception stack trace --- 
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(Boolean trySnapInName, String moduleName, String fileName, Assembly assemblyToLoad, String moduleBase, SessionState ss, String prefix, Boolean loadTypes, Boolean loadFormats, Boolean& found) 
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleNamedInManifest(String moduleName, String moduleBase, Boolean searchModulePath, String prefix, SessionState ss, Boolean loadTypesFiles, Boolean loadFormatFiles, Boolean& found) 
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(ExternalScriptInfo scriptInfo, ManifestProcessingFlags manifestProcessingFlags, Version version) 
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(String fileName, String moduleBase, String prefix, SessionState ss, Boolean& found) 
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord() 
at System.Management.Automation.Cmdlet.DoProcessRecord() 
at System.Management.Automation.CommandProcessor.ProcessRecord() 
--- End of inner exception stack trace --- 
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input) 
at System.Management.Automation.Runspaces.Pipeline.Invoke() 
at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.Invoke(String command, Object input, Boolean outputResults) 
at NuGetConsole.Host.PowerShell.Implementation.PowerShellHostExtensions.ImportModule(PowerShellHost host, String modulePath) 
at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.LoadStartupScripts() 
at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.Initialize() 
at NuGetConsole.Implementation.Console.ConsoleDispatcher.Start() 
at NuGetConsole.Implementation.PowerConsoleToolWindow.MoveFocus(FrameworkElement consolePane) 
+0

請參閱相關問題的答案:http://stackoverflow.com/questions/10457039/nuget-powershell-and-executionpolicy – 2014-07-09 10:36:56

回答

8

唯一可行的解​​決方案是在啓動VS2010之前手動啓動PowerShell。

所以如果任何人有這個問題,這是快速解決。

+0

令人難以置信的惱人的「功能」的PowerShell。我在「LocalMachine」範圍內將策略設置爲「繞過」,但我看到了這一點。在VS開始前運行PS,thx節省了我的時間 – galaktor 2012-07-16 09:36:25

2

的NuGet需要Powershell2才能正常工作。您可以從這裏下載並安裝:http://support.microsoft.com/kb/968929

+0

此外沒有powershell 2請確保你使用的是最新版本的NuGet http://nuget.org/。 – davidfowl 2011-04-15 09:29:02

+0

是的,但錯誤消息是從PowerShell 1.0目錄拉:) – 2011-04-15 15:33:39

+0

版本> 1.0的錯誤消息告訴你到底什麼是錯的:)。 – davidfowl 2011-04-16 00:19:22

0

啓動powershell並沒有幫助我。我發現這是一個已知的Nuget問題。您遇到此問題是因爲您已安裝並啓用了紅色門反射器加載項。如果您將Reflector更新爲最新版本(> = 6.5),它應該可以工作。

請看看這個鏈接

http://nuget.codeplex.com/workitem/265

+0

沒有安裝Reflector插件。這是最初的問題。 :d – Drakche 2011-10-03 07:59:36

0

生產力電動工具是我的問題。 v12.0.30129.0我禁用了它 - 卸載沒有必要 - 並與2013年再次工作