How to get rid of "The referenced component could not be found"
-
Friday, September 21, 2012 10:50 AM
hi.
i have a vs 2010 solution with c#, managed c++ and native c++ projects. for each reference to a c++ project from a managed project, in the Error List, i get the warning "the referenced componente [Name Of native Project Here]" cannot be found. Also, all those references have a yellow warning icon in solution explorer. The solution builds just fine. How can i get rid of these warnings?
WM_THX
-thomas woelfer
All Replies
-
Friday, September 21, 2012 2:42 PMModerator
I suspect this is related to your other post about the platform mixing. Resolve that issue first and see if this one goes away. If it doesn't then look at the path that VS is using for each reference and confirm the binary is actually present and of the right platform.
Michael Taylor - 9/21/2012
http://msmvps.com/blogs/p3net
-
Monday, September 24, 2012 3:41 PM
Michael,
i don't have any binary references, only project references. the build order is ok, so everything is available in the right places at the right time... i doubt this has anything to do /w the platform mixing stuff (will try though). Any other ideas? Isn't there any way to get rid of ide/build system warnings like with compiler #pragmas. (Obviously not with #pragmas, but maybe this can be configured somewhere ?)
WM_THX
-thomas -
Monday, September 24, 2012 4:52 PMModeratorTo clarify are you referencing the managed C++ projects from the C# code or are you trying to reference the native C++ code?
-
Monday, September 24, 2012 7:33 PM
Michael,
i just removed the mixed platform warnings (see other thread), and the warnings concerning 'component does not exist' persist.
concerning the references: i have c# projects that reference managed c++ projects.
WM_THX
-thomas -
Tuesday, September 25, 2012 2:46 AMModeratorThere isn't an option to get of the warnings. Does the diagnostic build log convey anything useful?
-
Tuesday, September 25, 2012 2:45 PM
the message does not appear during the build. it appears soon as the solution is loaded an simply never goes away.
WM_THX
-thomas woelfer -
Tuesday, September 25, 2012 6:21 PMModeratorIf assemblies aren't available when VS loads then it'll do that. Generally a build will get rid of the messages but not always. Sometimes removing and adding the reference back also solves the issue. Beyond that it is probably OK to ignore it.
-
Thursday, September 27, 2012 10:56 AM
Michael,
the assemblies are available at load time. the build does not get rid of the messages. adding and removing the reference does not get rif of the messages.
and i really don't want to "ignore" them, because they fill up the error list and i can't see the "real" issues...
WM_THX
-thomas woelfer -
Thursday, September 27, 2012 1:53 PMModerator
Open the project file manually and look at the hint path and name of the assembly to ensure they are accurate. If they are then try removing the reference and then adding it back and see if the warning goes away. If it does then save the project, close the solution and reopen it to see if it sticks.
Michael Taylor - 9/27/2012
http://msmvps.com/blogs/p3net
-
Thursday, September 27, 2012 2:16 PM
i'm not sure what the "hint path" is. i looked in the project, and found this:
<ProjectReference Include="..\..\..\kernel\native\kernel.native.calculations.design.concrete.shell\kernel.native.calculations.design.concrete.shell.vcxproj">
<Name>kernel.native.calculations.design.concrete.shell</Name>
<Project>{35559B4B-EE2A-4D96-9C74-3587A756FCC2}</Project>
<Package>{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}</Package>
</ProjectReference>the "include" value points to the correct path, the name is correct also. i have no idea what "Project" and "Package" is about.
if i remove the refernce and try to add it again, i get an error message:
"A reference to 'projectNameHere' could not be added. An assembly must have a 'dll' or 'exe' extension in order to be referenced.
well the assembly-project i'm trying to reference is producing dll. i 'ok'ed the error and got the last copy of my solution from revision control. seems like i _cannot_ add the references one i remove them. (frankly, i was under the impression i could re-add them and simply would get the same warning as before. seems i was mistaken.)
WM_THX
-thomas woelfer -
Thursday, September 27, 2012 2:54 PMModerator
But it does convey some useful information to us. The reason you're getting the warnings is because the IDE doesn't see the references as valid assemblies. Is the kernel.native...vcxproj being compiled as C++/CLI? If not then you can't add the reference. If it is then verify that you're using C++/CLI and not Managed C++ and that the targeted framework version matches the version you're using in the managed code.
Michael Taylor - 9/27/2012
http://msmvps.com/blogs/p3net
-
Friday, September 28, 2012 3:13 PM
Michael,
the project is not compiled as c++/cli, but it does contain a file that is compiler with /clr (which, afaik, i c++/cli). the target framework is correct.
i added these references when still using a previous version of vs. (i just checked and there is no such warning when you add a reference to a native c++ assembly that contains at least one c++/cli compiled file to a managed code project in vs 2005.)
i added these references because i wanted to make vs copy the result of the referenced assembly (a dll) to the target directory of the referencing project. (which vs does). this is nice because it works "automatically" for each configuration/platform.
is there another way to archive this. (iow: if i removed the refences, how would i proceed in order to get these dlls copied over. [apart from a batch that is run as a post-build step? (which is something i'd rather not do...)])
oh, and i just checked: this warning is gone in vs2012. (so it wasn't there in 2005 and it's gone again in 2012 - but i'm stuck with 2010 for the time beeing...)
WM_THX
-thomas woelfer
- Edited by thomas_woelfer Friday, September 28, 2012 3:19 PM added some more info
-
Saturday, September 29, 2012 2:59 AMModerator
Post-build events are the "correct" way to copy assemblies. An alternative approach is to set the output directory of all required assemblies to a common path. The latter approach is the one I most often use. I don't know of any way to disable a true warning like this. It's possible it is just a platform targeting problem but if it goes away in VS2012 then that is unlikely.
Michael Taylor - 9/28/2012
http://msmvps.com/blogs/p3net
- Proposed As Answer by Bob ShenMicrosoft Contingent Staff, Moderator Tuesday, October 02, 2012 5:57 AM
- Marked As Answer by thomas_woelfer Tuesday, October 02, 2012 8:45 AM

