0

我正在编写一个依赖于 EntityFramework 5.0.0.0 的 Visual Studio 扩展。我在我的项目中包含了 EntityFramework。当我安装我的扩展程序时,我的扩展程序的 DLL 出现在 VS 扩展文件夹中,并且 EntityFramework.dll 也随之出现。

但是,当我在 Visual Studio 2013(更新 5)中运行我的扩展时,它无法加载 EntityFramework:System.IO.FileNotFoundException: Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

查看 Process Monitor,我看到当我运行我的扩展程序时,VS2013 尝试从不同的路径加载 EntityFramework,它具有不同的版本 - 4.2。我希望 VS2013 继续搜索 EntityFramework,并在我的扩展程序的文件夹中找到它,就像我的扩展程序中包含的其他 dll 一样,但事实并非如此。

在 VS2015 中,VS 确实设法加载了 EntityFramework 5.0.0.0,但它也是从另一个不同的路径加载的。

为什么VS2013不继续在我的扩展文件夹中搜索EntityFramework?

4

1 回答 1

0

您需要指定一个ProvideCodeBase属性来指定应该加载您的额外程序集。“有时”你很幸运,它会找到其他东西,但这永远不能保证有效。您可以在此处看到一些使用的示例。

于 2016-05-19T17:58:26.653 回答