在Visual Studio 2013 win 7中安装EntityFramework的错误

时间:2015-02-16 16:29:39

标签: c# entity-framework visual-studio-2013 windows-7

我正致力于Visual Studio 2013 win 7中的RESTful Web服务设计。

我需要运行" Enable-Migrations" to ennables项目中的Code First Migrations。

这可以将Migrations文件夹添加到我的项目中。文件夹中将有一个Configuration.cs。

我需要安装新版本的EntityFramework。

当我安装它时,我收到错误:

 PM> Install-Package EntityFramework -IncludePrerelease
 Installing 'EntityFramework 6.1.3-beta1'.
 You are downloading EntityFramework from Microsoft, the license    agreement to which is available at http://go.microsoft.com/fwlink/?LinkID=xxxxxxx. 

 Successfully installed 'EntityFramework 6.1.3-beta1'.
 Do you want to run software from this untrusted publisher?

 File \\Mypath\packages\EntityFramework.6.1.3-beta1\tools\init.ps1 is    published by CN=Microsoft Corporation, OU=MOPR, O=Microsoft Corporation, L=Redmond, S=Washington, C=US and 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"):R

Do you want to run software from this untrusted publisher?

File \\Mypath\packages\EntityFramework.6.1.3-beta1\tools\EntityFramework.psm1 is published by CN=Microsoft Corporation, OU=MOPR, O=Microsoft Corporation, L=Redmond, S=Washington, C=US and 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"):R

Adding 'EntityFramework 6.1.3-beta1' to ProductReviews.
Successfully added 'EntityFramework 6.1.3-beta1' to ProductReviews.

Do you want to run software from this untrusted publisher?

File \\Mypath\packages\EntityFramework.6.1.3-beta1\tools\install.ps1 is published by CN=Microsoft Corporation, OU=MOPR, O=Microsoft Corporation, L=Redmond, S=Washington, C=US and 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"):R

 Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file://\\Mypath\packages\EntityFramework.6.1.3-beta1\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"

 At \\Mypath\packages\EntityFramework.6.1.3-beta1\tools\EntityFramework.psm1:780 char:62
  +     $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

You cannot call a method on a null-valued expression.
At \\Mypath\packages\EntityFramework.6.1.3-beta1\tools\EntityFramework.psm1:781 char:50
 +     $dispatcher = $utilityAssembly.CreateInstance <<<< (
 + CategoryInfo          : InvalidOperation: (CreateInstance:String) [], RuntimeException
 + FullyQualifiedErrorId : InvokeMethodOnNull

 Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:// \\Mypath\packages\EntityFramework.6.1.3-beta1\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"

 At \\Mypath\packages\EntityFramework.6.1.3-beta1\tools\EntityFramework.psm1:809 char:31
 +     $domain.CreateInstanceFrom <<<< (
 + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

 Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file://\\Mypath\packages\EntityFramework.6.1.3-beta1\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"

  At \\ Mypath\packages\EntityFramework.6.1.3-beta1\tools\EntityFramework.psm1:780 char:62
  +     $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

我不明白这个错误。怎么解决? 谢谢!

更新

我现在可以使用本地驱动器来构建项目。

但是,我收到了一个新错误,请参阅随附的图片。

enter image description here

1 个答案:

答案 0 :(得分:0)

您的错误意味着与您使用的网络共享(\ Mypath)相关。

Microsoft在最后一个补丁日应用了一个安全更新来强化UNC路径。也许这会导致我们的问题。我从未使用网络共享来创建项目。我总是使用本地路径并将更改提交到版本控制软件中。第二个问题是一个新问题。在新问题中提供有关模型和错误的更多详细信息。