Thursday, January 18, 2007 8:51 PMHi everybody,
I don't know why I'm not able to compile my project. The solution consists of multiple projects. Two are library projects, each which normal classes and wpf-windows in it. One of these projects rejects compiling because InitializeComponent() couldn't be found. In the other project, with exactly the same referenced assemblies, there isn't this kind of error.
Does anyone know a solution for this prob? Thx!
Thursday, January 18, 2007 8:58 PMModeratorI think you are missing x:Class="..." in .xaml file
Thursday, January 18, 2007 9:11 PMHi lee,
x:Class is set correctly in the xaml-file. The error occurs in the code-behind file where IntitializeComponent() is called in the constructor.
Thursday, January 18, 2007 9:21 PMModerator
add <Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" /> in my .csproj file.
this post might be helpful
Friday, January 19, 2007 9:04 AMHi Lester,
that was the solution for my problem! Thanks a lot.
What I don't understand is that in your link above the usage of a winForms application is shown, where you have to add this line manually. But I did create a WPF project. Shouldn't this line/reference be added automaticly in this case?
Thursday, August 07, 2008 10:46 PMDaSch,
I had the same problem recently as well. Initializecomponent is not at fault, it is not missing, what you are missing is the inclusion of the correct & latest library references to your project.
What you have to do is :
- Rebuild each class library
- For each project that requires a DLL, re-add the DLLs you need. Note that sometimes it is better to include ALL DLLs that you have created because sometimes you might think you don't need a certain DLL for a particular project and you actually do.
- Rebuild the main project and then run it.
Doing these steps, helped me eliminate the problem. Hopefully this will help you too.