David Montec
David Montec

Reputation: 31

C# The type or namespace 'Core' could not be found. CS0246

Im using VisualStudio 2017 Community Edition. Im starting out to develop Xamarin.Native using MVVMCross.

AS I started it out It seems I encountered a bug that I dont understand.

C# The type or namespace 'Core' could not be found. CS0246

Im watching this video-tutorials-mvvm-starterpack

I followed the instructions carefully and encountered the bug and I even tried to fix the bug which is stated here still nothing happened.

So this is where the issue occurs in Setup.cs under my Xamarin.Android.

using Android.Content;
using MvvmCross.Droid.Platform;
using MvvmCross.Core.ViewModels;
using MvvmCross.Platform.Platform;

namespace MVVMApp1.Droid
{
    public class Setup : MvxAndroidSetup
    {
        public Setup(Context applicationContext) : base(applicationContext)
        {
        }

        protected override IMvxApplication CreateApp()
        {
            return new Core.App(); // here problem lies the Core 
        }

        protected override IMvxTrace CreateDebugTrace()
        {
            return new DebugTrace();
        }
    }
}

Kindly guide me to the right direction.

Upvotes: 1

Views: 738

Answers (2)

Maurits van Beusekom
Maurits van Beusekom

Reputation: 5989

The line that is causing the problem is trying to instantiate the App class which is located in the shared (or core) project. In this case the Core refers to the namespace core project containing the shared code if the app. There could be a view things wrong here:

  1. Make sure you reference your core project from your Android and iOS projects;
  2. Check the namespace of the App class inside your core project. MvvmCross StarterPack assumes it is called <YourAppName>.Core (in your case MVVMApp1.Core). If you used a different name, simply update the call to Core.App(); to contain the correct namespace (note that you also include the correct using statement and still make sure the project is referenced, see point 1).

Hope this helps. If you have more questions don't hesitate to ask.

Upvotes: 1

ali baghjeri
ali baghjeri

Reputation: 141

In your source code you have MvvmCross.Core namespace which may have conflict with YourApp.Core namespace. Use full namespace :

return new MyApp.Core.App();

Upvotes: 1

Related Questions