1. 程式人生 > >關於編寫WPF UserControl時提示The name 'InitializeComponent' does not exist in the current contextr的解決!

關於編寫WPF UserControl時提示The name 'InitializeComponent' does not exist in the current contextr的解決!

1、開啟.csproj(工程)檔案。

2、找到<Import Project="$(MSBuildBinPath)/Microsoft.CSharp.targets" />這一行

3、在這一行下面新增<Import Project="$(MSBuildBinPath)/Microsoft.WinFX.targets" />

4、儲存檔案。

 這時就可以編譯通過了。