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.
When I instead add a reference to the dll, the assembly build output of the plugin, I get no such warning. What could this warning be trying to tell me?
As mentioned in the question's comments, differing .NET Framework versions between the projects can cause this. Check your new project's properties to ensure that a different default version isn't being used.
Encountered the same issue with a ASP.Net Web App and two library class projects which needed to be referenced within the Web App. I had no information provided on why the build failed and the references were invalid.
Solution was to ensure all projects had the same Target Framework:
In Visual Studio 2015- Right Click project > Properties > Application > Target Framework
Save, Clean and Rebuild solution. The project references should no longer appear as yellow warnings and the solution will compile.
My Web App was targeting .Net 4.5 whereas the other two dependent library class projects targeted .Net v4.5.2
For both of (or all of) the projects that you want to use together:
Right click on the project > Properties > Application > Target .NET framework
Make sure that both of (or all of) your projects are using the same .NET framework version.
- Make sure all versions are same for each projects click each projects and see the version here Project > Properties > Application > Target .NET framework
a. Go to Tools > Nuget Package Manager > Package Manager Console Type Update-Package -Reinstall (if not working proceed to 2.b)
b. Remove < Target > Maybe with multiple lines < /Target > usually found at the bottom part of .csproj.
Save, load and build the solution.
Reinstall all packages in all projects of the current solution:
Update-Package -Reinstall
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.
Check NETFramework of the referred dll & the Project where you are adding the DLL. Ex: DLL ==> supportedRuntime version="v4.0" Project ==> supportedRuntime version="v3.0"
You will get warning icon. Solution : Make dll version consistence across.
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. When I double clicked VS refreshed the references and removed the icons on some of those[EDIT: which it could NOW locate]. For remaining references, I had to compile the respective assemblies.
For me, I ran into this issue when referencing a .NET Standard 2.0 class library in a .NET Framework 4.7.1 console application. Yes, the frameworks are different, but they are compatible (.NET Standard is supposed to jive with both .NET Core and .NET Framework.) I tried cleaning, rebuilding, removing and readding the project reference, etc... with no success. Finally, quitting Visual Studio and reopening resolved the issue.
Adding my 2 cents to the @kad81 answer,
Go to Visual Studio -> BUILD -> Configuration Manager
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.
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".)
Rebuild the library projects first and then referencing projects. Hope this helps.
In Asp.net core sometime it shows alert if you changes the project name space or name. To remove this kind of alerts you just Unload Project and load it again. If issue is still there means you it can not find your Assembly reference.
I had these icons for a different reason. We have one big solution for all our projects (nearly 100). I made a subselection of the projects I was interested in and made a new solution. However the references where project references instead of references to the compiled dll's....
After some research I found this link on GitHub which explains this is new behaviour in VS2015.
On the GitHub page they explain a workaround for converting project references to binary references.
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.
Try closing and opening VS.
Seems silly but after 1 hour of following the above and finding everything lined up OK. I restarted VS 2017 and the problems were gone.
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.
in VS 2017 Do a Clean then Build
来源:https://stackoverflow.com/questions/20186216/why-do-i-get-a-warning-icon-when-i-add-a-reference-to-an-mef-plugin-project