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
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.
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.
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
In a multi-project solution, If every other thing failed... On the startUp project, check. Dependencies->Assemblies and see if the erring referenced project is there. Remove it and re-build.
Based on the answer from @AljohnYamaro (sorry, couldn't comment on your answer, new account without enough reputation yet, but upvotaded you), I've checked the .csproj file.
On my file, besides the standard project reference:
<ProjectReference Include="..\ProjectA\ProjectA.csproj">
<Private>true</Private>
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
</ProjectReference>
There were also a directy link to the compiled dll from the referenced project:
<ItemGroup>
<Reference Include="ProjectA">
<HintPath>..\ProjectA\bin\Debug\netcoreapp3.1\ProjectA.dll</HintPath>
</Reference>
</ItemGroup>
Removing this second reference solved the issue.