Windows Phone 8 app does not contain a definition for InitializeComponent

后端 未结 6 1189
太阳男子
太阳男子 2020-12-18 04:47

I have just downloaded the 14 CTP version of Visual Studio and created a blank app for Windows Phone. I tried to open the MainPage.xaml and the designer shows u

相关标签:
6条回答
  • 2020-12-18 04:52

    It does not work for me. Just created new local account with Administrator type (Window 8.1, VS 2013 update 4). Login by the new local account. Open and see it is solved.

    0 讨论(0)
  • 2020-12-18 04:58

    Check your x:class property in your page

    0 讨论(0)
  • 2020-12-18 05:03
    1. “tools”——>"extensions and updates"——>install or update "nuget package manager" and something like that ;
    2. try to open as administrator
    3. it seems like disk in fat32 will lead to the error
    4. if u install Silvertlight before the SDK ,it may lead to the error
    0 讨论(0)
  • 2020-12-18 05:09

    Ensure the class name on your XAML matches the class name in your code-behind. I've run into this a few times while refactoring.

    XAML Opening Tag:

    <UserControl
        x:Class="Namespace.Foo"
        ... />
    

    Code Behind:

    public sealed partial class Bar : UserControl
    {
        public Bar()
        {
            // This will become the error specified (does not contain definition)
            this.InitializeComponent(); 
        }
        ...
    }
    

    So Namespace.Foo would need to be Namespace.Bar here to get rid of the error. This should have the same behavior if using Page instead of UserControl.

    0 讨论(0)
  • 2020-12-18 05:10

    the same started to happen to me today; to reproduce the issue, I just open Visual Studio 2013 Update 4, create a blank Windows Phone 8.1 and double click on MainPage.xaml.

    I solved by performing the following (a mix of what I've read around the web):

    • exit all Visual Studio instances
    • delete everything on %localappdata%\Microsoft\VisualStudio\12.0\Designer\ShadowCache
    • open a command prompt with admin rights and execute the following commands:

      pushd %VS110COMNTOOLS%
      icacls ..\IDE /grant *S-1-15-2-1:(OI)(F)
      icacls ..\IDE /grant *S-1-15-2-1:(CI)(F)
      icacls ..\IDE\PrivateAssemblies /grant *S-1-15-2-1:(OI)(F)
      icacls ..\IDE\PrivateAssemblies /grant *S-1-15-2-1:(CI)(F)
      icacls ..\IDE\PublicAssemblies /grant *S-1-15-2-1:(OI)(F)
      icacls ..\IDE\PublicAssemblies /grant *S-1-15-2-1:(CI)(F)
      

    finally, reboot. worked on Windows 8.1 64-bit.

    0 讨论(0)
  • 2020-12-18 05:16

    Ran into same problem today, Fixed it by killing all instances and opening it up again.

    0 讨论(0)
提交回复
热议问题