Why do I get a warning icon when I add a reference to an MEF plugin project?

后端 未结 23 1313
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 17:30

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 p

相关标签:
23条回答
  • 2020-11-30 18:05

    In Visual Studio 2019, one of my projects target framework was .net core but it was referencing another project whose target framework was .net standard. I changed all of the projects to reference .net standard and the icons went away. To see what your project is right click it and click properties and look at Target framework. You can also normal click the project itself and look at the < TargetFramework > tag under < PropertyGroup >

    0 讨论(0)
  • 2020-11-30 18:07

    I also faced the same problem but my case was a bit different the ones above. I tried to open a project created in a different computer. I found that the path to package folder is not updated when you add a reference so restarting VS, changing .NET version, or any mentioned recommendation does not solve the problem. I opened the csproj file in notepad++ and corrected all the relative paths to packages folder. Then; all the warnings are gone. Hope it helps.

    0 讨论(0)
  • 2020-11-30 18:09

    I had the same issue in a solution with projects targting .NET Core 3.1, .NET Standard 2.0 and .NET Framework 4.8. The issue was on this last one.

    The trick that solved the issue for me, was to change the target framework to .NET Framework 4.5, then back to .NET Framework 4.8.

    I have absolutely no idea why this fixed the issue, but it did.

    The IDE was Visual Studio 2019.

    0 讨论(0)
  • 2020-11-30 18:11

    Using Visual Studio 2019 with all projects targeting .Net Core 3.1 the solution was to:

    1. Clean / Build / Rebuild.
    2. Restart Visual Studio 2019
    0 讨论(0)
  • 2020-11-30 18:11

    To fix some not working stuff it has sense to remove some libraries sometimes, how would not that sound weird.

    Anyways, I believe the problem is too wide and might be caused by different factors, so want to share my situation/solution.

    I had a project (brought by customer) with Xamarin Forms and Telerik libraries. The thing was in general related to the components, which libraries are not included into packages folder, nor available via Nuget (paid ones).

    The whole project References were "yellow", it looked horribly and scary.

    The solution was just to remove those Telerik references (including a few controls in code which were using that). Right after that all the references magically got their common normal grey color and the errors (mostly) disappeared.

    "Mostly" - because "all red around" error messages about "the element is not defined anywhere" sometimes happen still. That's weird, and brings inconvenience, but I still able to compile and run the project(s): just need to clean solution, restart Visual Studio, pray a little bit, clean again, remove obj/bin folders, restart again, and it works well.

    The key thing is remove not available libraries references, as the error messages say absolutely another stuff. (For instance, something like "Xamarin.Build.Download.XamarinDownloadArchives not found or cannot find something" etc., but that just might mean you don't have some references available.

    Then remove packages folder, reload/reopen the project/solution, go to "Manage Nuget Packages" and click "Restore" button.

    0 讨论(0)
  • 2020-11-30 18:12

    Make sure you have the projects targeting the same framework version. Most of the times the reason would be that current project ( where you are adding reference of another project ) points to a different .net framework version than the rest ones.

    0 讨论(0)
提交回复
热议问题