当添加对MEF插件项目的引用时,为什么会出现警告图标?

本文翻译自:Why do I get a warning icon when I add a reference to an MEF plugin project?

I wish to test the core class of a plugin by directly referencing the plugin project and instantiating the plugin class. 我希望通过直接引用插件项目并实例化插件类来测试插件的核心类。 When I create a test Console App project and add a project reference to the plugin project, I get a warning icon (yellow triangle with exclamation mark) next to the reference in the References list. 创建测试Console App项目并将项目引用添加到插件项目时,在“引用”列表中的引用旁边会出现一个警告图标(带有感叹号的黄色三角形)。

When I instead add a reference to the dll, the assembly build output of the plugin, I get no such warning. 当我改为添加对dll(插件的程序集生成输出)的引用时,没有得到这样的警告。 What could this warning be trying to tell me? 这个警告可能试图告诉我什么?


#1楼

参考:https://stackoom.com/question/1MhM8/当添加对MEF插件项目的引用时-为什么会出现警告图标


#2楼

It's been a long time since this question was asked but if someone is still interested - I recently ran into similar icons. 自问这个问题以来已经有很长时间了,但是是否有人仍然对此感兴趣-我最近遇到了类似的图标。 I was compiling a C#.net project using VS 2008. I found VS could not locate the assemblies for those references. 我正在使用VS 2008编译C#.net项目。我发现VS找不到这些引用的程序集。 When I double clicked VS refreshed the references and removed the icons on some of those[EDIT: which it could NOW locate]. 当我双击VS时,刷新了参考,并删除了其中一些的图标[编辑:现在可以找到]。 For remaining references, I had to compile the respective assemblies. 对于其余参考,我必须编译各自的程序集。


#3楼

As mentioned in the question's comments, differing .NET Framework versions between the projects can cause this. 正如问题注释中提到的,项目之间的不同.N​​ET Framework版本可能会导致这种情况。 Check your new project's properties to ensure that a different default version isn't being used. 检查新项目的属性,以确保未使用其他默认版本。


#4楼

Adding my 2 cents to the @kad81 answer, 将我的2美分加到@ kad81答案中,

Go to Visual Studio -> BUILD -> Configuration Manager 转到Visual Studio->构建->配置管理器

In the "Active Solution Platform" drop down in top right hand corner (mine is VS 2012), if it is "Mixed Platforms", change it to the appropriate platform based upon your reference third party assemblies. 在右上角的“ Active Solution Platform”下拉菜单中(我的是VS 2012),如果是“ Mixed Platforms”,请根据您参考的第三方程序集将其更改为适当的平台。

Then in each of the project in the list, make sure you select same platform for all the project. 然后,在列表中的每个项目中,确保为所有项目选择相同的平台。 (if x86 not exist, then select "", then you can select "x86".) (如果x86不存在,则选择“”,然后可以选择“ x86”。)

Rebuild the library projects first and then referencing projects. 首先重建库项目,然后再参考项目。 Hope this helps. 希望这可以帮助。


#5楼

重新安装当前解决方案的所有项目中的所有软件包:

Update-Package -Reinstall

#6楼

Check NETFramework of the referred dll & the Project where you are adding the DLL. 检查引用的DLL和要在其中添加DLL的项目的NETFramework。 Ex: DLL ==> supportedRuntime version="v4.0" Project ==> supportedRuntime version="v3.0" 例如:DLL ==> supportedRuntime版本=“ v4.0”项目==> supportedRuntime版本=“ v3.0”

You will get warning icon. 您将收到警告图标。 Solution : Make dll version consistence across. 解决方案:使dll版本保持一致。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章