當添加對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版本保持一致。

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