locked
Error on new windows 8.1 project: The type or namespace name 'Foundation' does not exist in the namespace RRS feed

  • Question

  • I upgraded to win 8.1 and VS 2013. I created a new Windows 8.1 C# grid  project and tried to compile it and I'm seeing the  following error: Error 1 The type or namespace name 'Foundation' does not exist in the namespace [my namespace](are you missing an assembly reference?)

    The errors are in navigationhelper.cs line 59  

    [Windows.Foundation.Metadata.WebHostHidden] // Foundation has the squigglies
    public class NavigationHelper : DependencyObject

    and app.xaml.cs line 68 ==> rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; which causes this error: Error 2 The type or namespace name 'Globalization' does not exist in the namespace [my namespace] (are you missing an assembly reference?)

    Windows phone and mvc projects are working fine and I've installed all the updates and even tried to fix vs 2013.

    Any help Is greatly appreciated.

    Saturday, November 23, 2013 8:54 AM

Answers

  • I solved this by just adding the using statement for the namespaces at the top of each file.

    i.e. using Windows.Globalization and using Windows.Foundation.Metatdata.

    But this uncovered a problem in the default template  with a project name that has a dot in it.

    • Marked as answer by Kwacks Saturday, November 23, 2013 6:53 PM
    Saturday, November 23, 2013 6:53 PM

All replies

  • I did some more investigation and noticed that if I create an app with a "." in the name then this problem occurs. For example create a windows store project with the default name "App1": this will compile.

    However if I name the project "App1.Forms" to correspeond with the default namespace I want, then this problem occurs.  Still investigating but anyone should be able to repro it with that step.

    Saturday, November 23, 2013 6:47 PM
  • I solved this by just adding the using statement for the namespaces at the top of each file.

    i.e. using Windows.Globalization and using Windows.Foundation.Metatdata.

    But this uncovered a problem in the default template  with a project name that has a dot in it.

    • Marked as answer by Kwacks Saturday, November 23, 2013 6:53 PM
    Saturday, November 23, 2013 6:53 PM
  • This problem occures not because you're using dots in your namespace, but because you're using the name Windows in your namespace, which I don't think you actually should do. Are you sure App1.Forms doesn't compile? There shouldn't be a problem with such a project name, but there might be a problem if you want to create two projects and name them MyApp.Windows and MyApp.WindowsPhone. MyApp.Windows won't copile.
    Monday, February 23, 2015 12:28 AM