6

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?

Community
  • 1
  • 1
Victor
  • 13,914
  • 19
  • 78
  • 147
  • Check your MainPage.Xaml.cs has the same name as xaml PAGE – Sajeetharan Jul 06 '14 at 06:22
  • by *name* you mean `x:Class`? – Victor Jul 06 '14 at 06:24
  • I am new to Windows Phone programming, but this doesn't belong to programming of my project actually. It is a Visual Studio error... (I have to mention that the same happened in the 2013 Ultimate version) – Victor Jul 06 '14 at 06:43
  • ! well i have not tried with vs14 but have you installed the latest SDK and what is your OS? – Sajeetharan Jul 06 '14 at 06:47
  • In the installation of Visual Studio, I checked the installation of Windows Phone SDK (that's all). My OS is Windows 8.1 64 bits. – Victor Jul 06 '14 at 06:49
  • Try changing the XAML page's `Build Action` to `Page`, delete the `obj` folder in your project directory, and the rebuild. – keyboardP Jul 06 '14 at 08:15
  • it is already set to Page – Victor Jul 06 '14 at 08:31
  • @Victor. Did you manage to find a solution? I am running into the same problem, as a lot of other people seem to do, but no clear solutions. If you solved it please paste the answer here as "your answer". – Core-One Jul 09 '14 at 18:23
  • Obviously I don't have any solutions... otherwise, I would have posted them – Victor Jul 10 '14 at 09:46

6 Answers6

5

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.

  • This solution in combination with [this answer](http://stackoverflow.com/a/18252141/2517147) solved the issue for me. – Zach Olivare Nov 29 '16 at 17:13
5

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.

Noppadet
  • 804
  • 9
  • 19
1

Check your x:class property in your page

M Jun
  • 19
  • 8
0
  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
Mr.Wrong
  • 21
  • 5
0

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

Muhammad Faizan
  • 1,709
  • 1
  • 15
  • 37
0

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.

aaron ngo
  • 41
  • 5