Powershell无法在VS 2013 Package Manager Console中找到其dll或依赖关系 [英] Powershell fails to find its dll or dependency in VS 2013 Package Manager Console

查看:858
本文介绍了Powershell无法在VS 2013 Package Manager Console中找到其dll或依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS Express 2013 .Net 4.5。我正在使用Oracle VirtualBox Windows 7 64位客户端中的MS SQLServer LocalDB在MVC5和EF6中设计。



我正在尝试使用以下命令应用SQL Server LocalDb迁移: / p>


PM>启用迁移-ContextTypeName SGHWA_MVC.Models.Context


这总是失败。



我有限的Web知识是使用Web窗体,所以我对MVC和EF完全是新的。我从来没有使用过PMC和Powershell。我已经搜索到解决方案,但没有找到类似于Package Manager Console生成的错误的问题。



首先有一个警告: -


无法确定有效的启动项目。改用项目'SGHWA_MVC'。您的配置文件和工作目录可能未按预期设置。使用-StartUpProjectName参数来显式设置。使用-Verbose开关获取更多信息。


PCM下拉框将默认项目正确显示为SGHWA_MVC。解决方案属性页显示这个项目作为启动项目。



我去了 http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference ,但看不到 -StartUpProjectName 参数提到。我不知道该参数适用于哪个命令。



然后出现第一个错误: -


异常用1参数调用LoadFrom:无法加载文件或程序集文件:// \W7O2007\Users\Admin\Documents\Visual Studio 2013\\ \\Projects\SGHWA_MVC\packages\EntityFramework.6.1.0\tools\EntityFramework.PowerShell.Utility.dll'或其一个依赖项不支持操作
(HRESULT异常:0x80131515) 在\W7O2007\Users\Admin\Documents\Visual Studio 2013\Projects\SGHWA_MVC\packages\EntityFramework.6.1.0\tools\EntityFramework.psm1:780 char:62

+ $ utilityAssembly = [System.Reflection.Assembly] :: LoadFrom<<<< ((Join-Path $ ToolsPath EntityFramework.PowerShell.Utility.dll))

+ CategoryInfo:NotSpecified:(:) [],MethodInvocationException

+ FullyQualifiedErrorId:DotNetMethodException


它表示文件不在那里被加载,但它确实存在于PC上所显示的路径上。我怀疑这是Join-Path失败,但不确定如何测试这个。



packages.config文件有一行: -


(领先<删除)包id =Powershell.Deploymentversion =1.1.0.0targetFramework =net45/>


我的研究表明它可以是权限,远程访问,项目构建应该将生成序列化程序集设为开,关或自动 NuGet软件包导致这种情况,但是我无法确定它是否是PMC,NuGet,Powershell或Windows问题。



另外还有两个与EntityFramework.psm1中的类似问题相关的错误消息似乎与这个第一个问题有关。



请任何人建议可能的原因,并引导我了解什么/如何测试和解决这个问题?

解决方案

我意识到这是一个旧线程,但我刚刚遇到这个问题,使用新安装的Mi我的解决办法是删除这个文件夹:

  C:\Users\\(我的用户名)\\.nuget\packages\EntityFramework\6.1.3 

,并允许下次将Entity Framework添加到项目时重新生成。最初,这个文件夹中缺少PowerShell DLL。奇怪的。


I'm using VS Express 2013 .Net 4.5. I'm designing in MVC5 and EF6 with MS SQLServer LocalDB in an Oracle VirtualBox Windows 7 64bit client.

I am trying to apply SQL Server LocalDb migrations with the command:

PM> Enable-Migrations -ContextTypeName SGHWA_MVC.Models.Context

This always fails.

My limited web knowledge is with Web Forms so I am completely new to MVC and EF. Also I have never used PMC and Powershell. I have searched for solutions but have not found questions similar to this error that Package Manager Console produces.

First there is a warning:-

Cannot determine a valid start-up project. Using project 'SGHWA_MVC' instead. Your configuration file and working directory may not be set as expected. Use the -StartUpProjectName parameter to set one explicitly. Use the -Verbose switch for more information.

PCM drop-down box shows the Default project correctly as SGHWA_MVC. The solution property pages show this one project as the start-up project.

I went to http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference but could not see the -StartUpProjectName parameter mentioned. I'm not sure to which command this parameter applies.

Then the first error appears:-

Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file://\W7O2007\Users\Admin\Documents\Visual Studio 2013\Projects\SGHWA_MVC\packages\EntityFramework.6.1.0\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"At \W7O2007\Users\Admin\Documents\Visual Studio 2013\Projects\SGHWA_MVC\packages\EntityFramework.6.1.0\tools\EntityFramework.psm1:780 char:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

It suggests the file is not there to be loaded but it does exist on the PC at the path shown. I suspect it is the Join-Path that fails but am unsure how to test this.

The packages.config files has a line:-

(leading < removed) package id="Powershell.Deployment" version="1.1.0.0" targetFramework="net45" />

My research shows it could be permissions, remote access, that the Project Build should have Generate Serialization Assembly as 'On', 'Off' or 'Auto' or even NuGet packages that cause this but I cannot determine if it is a PMC, NuGet, Powershell or Windows problem.

Two more error messages appear relating to similar problems in EntityFramework.psm1 and seem to be related to this first problem.

Please can anyone advise the likely cause and guide me through what/how to test and solve this?

解决方案

I realize this is an old thread, but I just ran into this problem using a newly-installed copy of Microsoft Visual Studio 2015 Enterprise with Update 1.

My solution was to delete this folder:

C:\Users\\(my user ID)\\.nuget\packages\EntityFramework\6.1.3

and allow it to be regenerated the next time the Entity Framework is added to a project. Originally, the PowerShell DLL's were missing from this folder. Strange.

这篇关于Powershell无法在VS 2013 Package Manager Console中找到其dll或依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆