的Windows Phone 8应用程序不包含的InitializeComponent的定义 [英] Windows Phone 8 app does not contain a definition for InitializeComponent

查看:611
本文介绍了的Windows Phone 8应用程序不包含的InitializeComponent的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚才下载的Visual Studio 14 CTP版,创造了Windows Phone的一个空白的应用程序。我试图打开 MainPage.xaml中和设计师展示了以下错误:

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 up the following errors:

和那些谁也看不出图像

System.Exception
Package failed updates, dependency or conflict validation.

Windows cannot install package App.a5cd6ef3c.a895b.a4508.a96fd.af1634c30bb13 because this package depends on another package that could not be found. This package requires minimum version 0.0.0.0 of framework Microsoft.VCLibs.140.00.Debug published by any publisher to install. Provide the framework along with this package.
   at Microsoft.Expression.HostUtility.Platform.AppContainerProcessDomainFactory.CreateDesignerProcess(String applicationPath, String clientPort, Uri hostUri, IDictionary environmentVariables, Int32& processId, Object& processData)
   at Microsoft.Expression.DesignHost.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory, IIsolationBoundary boundary, AppDomainSetup appDomainInfo, FrameworkName targetFramework, String identifier, String baseDirectory)
   at Microsoft.Expression.DesignHost.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
   at Microsoft.Expression.HostUtility.Platform.AppContainerProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
   at Microsoft.Expression.DesignHost.Isolation.Primitives.IsolationBoundary.Initialize()
   at Microsoft.Expression.DesignHost.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type)
   at Microsoft.Expression.DesignHost.Isolation.IsolatedObjectFactory.Initialize()
   at Microsoft.VisualStudio.ExpressionHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget isolationTarget, IObjectCatalog catalog)
   at Microsoft.Expression.DesignHost.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
   at Microsoft.Expression.DesignHost.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
   at Microsoft.Expression.DesignHost.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
   at Microsoft.Expression.DesignHost.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget, CancellationToken cancelToken, DesignerServiceEntry& entry)
   at Microsoft.Expression.DesignHost.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.Isolation.IsolatedTaskScheduler.InvokeWithCulture[T](CultureInfo culture, Func`2 func, CancellationToken cancelToken)
   at Microsoft.Expression.DesignHost.Isolation.IsolatedTaskScheduler.<>c__DisplayClass5`1.<StartTask>b__7()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()


我进入 App1.xaml.cs MainPage.xaml.cs中和我见过的应用的MainPage ,分别为,不必为的InitializeComponent)定义(

I entered App1.xaml.cs and MainPage.xaml.cs and I've seen that App and MainPage, respectively, don't have a definition for InitializeComponent().

该项目是它是由Visual Studio中创建的状态,我没有改变任何东西!

这是怎么回事,我怎么能解决呢?

Why is this happening and how can I solve it?

推荐答案

确保您的XAML类名称匹配您的代码隐藏类的名称。 。我同时重构碰上这几次

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开始标记:

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

代码背后:

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



所以Namespace.Foo需要在这里Namespace.Bar摆脱错误的。这应该如使用而不是用户控件

这篇关于的Windows Phone 8应用程序不包含的InitializeComponent的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆