Question

Can't save state in windows 8

{ 
Error   The type or namespace name 'Common' ...does not exist in the namespace 'ProjectName' (are you missing an assembly reference?) 
}

Everything below is the default code in my App.Xaml.cs file the only line I added was

                ProjectNameSpace.Common.SuspensionManager.RegisterFrame(rootFrame, "appframe"); 

which is from the windows 8 tutorial here and I have followed part 1 before attempting this http://msdn.microsoft.com/en-us/library/windows/apps/hh986968.aspx. I have it working in another project that has the same references and using statements. There is only one namespace in the project and I even Rebuilt/Cleaned. Does anybody have any extra information?

protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
            {
                rootFrame = new Frame();
                ProjectNameSpace.Common.SuspensionManager.RegisterFrame(rootFrame, "appframe"); 
                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                }

                Window.Current.Content = rootFrame;

EDIT: The problem was that I needed to add a basic page in my blank template. This auto generates some classes needed to do basic functionality. Below is a screenshot of the minimum items that the common folder needs to contain. Common Folder Screenshot

Was it helpful?

Solution

Do you have the Common folder present in your project? This folder is usually included in the Visual Studio 2012 App project templates (except the Blank App template) which contains a bunch of classes with boilerplate code for layout, styles and other functionality.

If you created your project with a Blank App template, you may not have this. To get it included, create a new Basic Page (Right-click on your Project > Add > New Item > (Visual C#)* > Basic Page), and Visual Studio will ask if you would like to create these files.

*I'm not sure what this is for VB .NET or WinJS, but I assume it would be the same structure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top