The name ‘InitializeComponent’ does not exist in the current context

August 29, 2007

If when creating a WPF control you get the above error on building your project then you are missing the following line from the csproj file: –

<Import Project=”$(MSBuildBinPath)\Microsoft.WinFX.targets” />

Add this and all will be well.