Universal App Gotchas : Namespaces must exist in all Platform Projects

In certain circumstances Visual Studio will quite happily suggest to add namespaces into Shared Projects that will then fail to compile.  It’s an obvious issue to resolve, with the bottom line being that the Namespaces must exist in all Platform Projects in order for it to be referenced by the Shared Project.


Take this example, I’ve created a new implementation of an interface and put it in a new Namespace in the Windows Project for Morse Coder :

namespace MorseCoder.Settings
public class WindowsMorseCoderSettings : IMorseCoderSettings

I’ll now attempt to use my new class in the ViewModelLocator class :


Note that Visual Studio is suggesting that I can add the using Statement for MorseCoder.Settings.

I follow it, attempt to build to be greeted with :

The type or namespace name 'Settings' does not exist...
The type or namespace name ‘Settings’ does not exist…


So as mentioned, the resolution is simple (and pretty obvious as to the cause) :

  • Ensure that all of your Types and Namespaces are available in all of your Platform specific Projects.

However, the moral of this story is :

  • just because Visual Studio suggests something, doesn’t always mean it will compile!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: