Tag Archives: Xamarin

Dealing with Spaces in a Xamarin Forms Project Name

If you include spaces in the name of a Xamarin forms project, when you try to run the app., you will get an error and warnings related to not being able to find and reference the head project.  This is because Visual Studio will replace the spaces in the name with “_” for the namespace used in all of the generated projects but it does not set the default namespace for the head project accordingly and it tries to reference the head project with “_” in the name instead of spaces.

Probably the best way to deal with this is to not use spaces in the project name.  However, if you created a solution with spaces in the name and you want to leave it that way, here’s how you can fix it:

  • Go to the Xamarin forms shared project properties and add “_” to the default name space.  So if your project name is “My Cool Project”, the default name space should be “My_Cool_Project”.
  • Go to each of the platform project’s references and delete the references to the shared project.  Then add the references back in.

If you try running the app having made the above changes, it should compile and run without errors or warnings.