Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
321 views
in Technique[技术] by (71.8m points)

c# - Windows Phone 8 app does not contain a definition for InitializeComponent

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:

enter image description here

and for those who can't see the image:

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()

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().

The project is in the state it was created by Visual Studio, I haven't changed anything!

Why is this happening and how can I solve it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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%MicrosoftVisualStudio12.0DesignerShadowCache
  • 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 ..IDEPrivateAssemblies /grant *S-1-15-2-1:(OI)(F)
    icacls ..IDEPrivateAssemblies /grant *S-1-15-2-1:(CI)(F)
    icacls ..IDEPublicAssemblies /grant *S-1-15-2-1:(OI)(F)
    icacls ..IDEPublicAssemblies /grant *S-1-15-2-1:(CI)(F)
    

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...