Forum Xamarin.Forms

Error CS0246: The type or namespace name 'Xamarin' could not be found

Why i am getting error in new generated Project (Xamarin.Forms Project)?
Error CS0246: The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) (CS0246)

Posts

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    It looks like your library project is missing the reference. I think template unfolding failed. Can you try re-creating the project?

  • RajivChowdheryRajivChowdhery USMember

    Yeah i got there is reference missing But my Question is Why? Even i Tried more than 10 times to re-create the project in Every possible way But still no way found to overcome this issue. Can you help me to override the problems?

    Thanks in Advance.

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    Are you using Xamarin Studio on Windows?

  • RajivChowdheryRajivChowdhery USMember

    Yeah right i am using Xamarin Studio for Windows Version 5.0

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    Okay I can confirm this is an issue on Xamarin Studio for windows, I am alerting the XS team. You probably want to use XS for OSX or using Xamarin for Visual Studio.

  • RajivChowdheryRajivChowdhery USMember

    Currently i am using XS on Windows, not Xamarin for Visual Studio.

  • RajivChowdheryRajivChowdhery USMember

    So now what should i do? i mean please can you suggest me a better or alternative way to Create Xamarin.Forms Project So i can move on my Project.

    Thanks @JasonASmith‌ for reply

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    I can't resolve your issue, the problem is a bug in Xamarin Studio for Windows. You will need to either use XS for OSX or Xamarin for Visual Studio until Xamarin Studio for Windows is fixed.

    Sorry :(

  • RajivChowdheryRajivChowdhery USMember

    OK, Thanks @JasonASmith‌

  • xeoxeo NZMember

    I had the same issue on OSX, I had to re-create the project.

  • nikolaj.skovnikolaj.skov DKMember ✭✭

    Also stuck. Xamarin Studio on Windows 8 trying to use Xamarin.Forms... I find it sad to waste my trial period doing nothing... :-(

  • CraigDunnCraigDunn USXamarin Team Xamurai

    I'm able to successfully download and run Xamarin.Forms samples from http://github.com/xamarin/xamarin-forms-samples on Windows 8.1 with Xamarin Studio 5 (Android parts of the solutions only).

    Even without being able to create a new, blank solution from scratch, it's fairly easy to pick one of the simpler sample apps and start modifying it. Don't let the Xamarin Studio for Windows broken template hold you back @nikolajskov‌ , @RajivChowdhery‌

  • nikolaj.skovnikolaj.skov DKMember ✭✭

    Thanks, @CraigDunn. I'll give it a try.

  • thatjuanthatjuan USMember

    Fixed this on XS OSX by going into Project > Edit referencers and double clicking on "Xamarin.Forms.Core.dll" on the right-hand side menu. Doesn't seem to do anything but the compile error went away.

  • I am using v5.2.1 and if you use NuGet (Project | Add Packages...) to search for Xamarin.Forms it will add the relevant packages to your project and this should get rid of the error message.

  • I was resolve it by Add Refrence of Project. Suppose your project is TestApp1, So to add its dll First select TestAPP1.Android >> Add >> Add Web Refrence >> Select TestApp1 Tab and Chose dll that required (TestApp1.dll) and click on Add. Now can build your project successfully.

  • wangzhizhouwangzhizhou USMember

    I find the solution for this problem. The reason for this error is the complier can not find the corresponding .dll files, so if you add the .NET Assembly path for that .dll file, you will solve the problem.

    right-click the "reference" of project, and enter the "Edit References...", then choose the ".NET Assembly" tab, click the "Browser.." button, navigate to the path of that .dll file, and make sure the right path be added in the reference, you
    will find everything is ok!

  • wangzhizhouwangzhizhou USMember

    PS: The platform is Windows 8.1 Professional Edition, and Xamarin Studio is version 5.7.1

  • wangzhizhouwangzhizhou USMember

    I found another solution for this problem. When I look through the setting files for project, I found something stange. For example, when I add the "POIApp" project to the "POITestApp" References, in the POITestApp.csproj file, there are something be added as follow:


    {921FF87A-B1A4-45AA-BBAB-77EBD858CEBF}
    POIApp
    True
    False


    But When I delete this following two lines from that file and save it:
    True
    False

    I found the problem be solved, the solution be bulid successfully. But the smart code intellsense still don't work. And I'm
    searching the reason cause it.

  • GarethFrowGarethFrow ZAMember ✭✭

    Xamarin studio so buggy!!

  • So, it's Jan 17 2016 and the issue is still there. Installed new XS >> New Hello World project >> Cannot find Xamarin.Forms
    Any ideas. Nothing of the obove mentioned fixes works...

    Xamarin Studio
    Version 5.10.1 (build 6)
    Installation UUID: 684bdc2b-d07c-479e-9322-b5f04221bbd6
    Runtime:
    Microsoft .NET 4.0.30319.34209
    GTK+ 2.24.23 (MS-Windows theme)
    GTK# 2.12.30

    Xamarin.Profiler
    Not Installed

    Xamarin.Android
    Version: 6.0.0 (Starter Edition)
    Android SDK: D:\Xamarin\google
    Supported Android versions:
    4.0.3 (API level 15)
    4.4 (API level 19)
    5.1 (API level 22)
    6.0 (API level 23)

    SDK Tools Version: 24.4.1
    SDK Platform Tools Version: 23.1

    SDK Build Tools Version: 23.0.2

    Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_71
    java version "1.7.0_71"
    Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
    Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

    Xamarin Android Player
    Not Installed

    Build Information
    Release ID: 510010006
    Git revision: 0b60eecdb531933734519c13257d16a780274aab
    Build date: 2015-12-04 19:20:22-05
    Xamarin addins: 9876fd7c9837977178411ec7375b4352c0a0d6af
    Build lane: monodevelop-windows-cycle6-baseline

    Operating System
    Windows 6.3.9600.0 (64-bit)

  • ilyasilyas USMember ✭✭

    I have a Problem:
    The type or namespace name 'PersistableBundle' could not be found(are you missing a using directive or and assembly reference?) (CS0246)

  • VishavPremlallVishavPremlall USMember

    Hi. I have the same issue as ilyas above. I need this to work so i can continue with my app. I am trying to learn how to use xamarin and mvvm but this is very hard and confusing.

    I am using Xamarin from within visual studio 2015 enterprise.

    All i am trying to do is create a splash screen for my app, something which took me minutes in Apache Cordova.

  • BernardABernardA USMember

    Hi I’m learning how to use a “Creating Custom Row Layouts” and I’m having the same issue with Visual Studio 2015, I’m getting an error on
    Error: The type or namespace name ‘TableItem’ could not be found(are you missing a using directive or an assembly reference?)

    Code example is from https://developer.xamarin.com/guides/android/user_interface/working_with_listviews_and_adapters/part_3_-_customizing_a_listview's_appearance/

    public class HomeScreenAdapter : BaseAdapter
    {
    ListView listView;

            List<TableItem> items;
            Activity context;
            public HomeScreenAdapter(Activity context, List<TableItem> items)
                : base()
            {
                this.context = context;
                this.items = items;
            }
            public override long GetItemId(int position)
            {
                return position;
            }
            public override TableItem this[int position]
            {
                get { return items[position]; }
            }
            public override int Count
            {
                get { return items.Count; }
            }
            public override View GetView(int position, View convertView, ViewGroup parent)
            {
                var item = items[position];
                View view = convertView;
                if (view == null) // no view to re-use, create new
                    view = context.LayoutInflater.Inflate(Resource.Layout.CustomView, null);
                view.FindViewById<TextView>(Resource.Id.Text1).Text = item.Heading;
                view.FindViewById<TextView>(Resource.Id.Text2).Text = item.SubHeading;
                view.FindViewById<ImageView>(Resource.Id.Image).SetImageResource(item.ImageResourceId);
                return view;
            }
        }
    

    My objective is to have the Android App display several rows for data that was consume from a REST server(Json serialization process).

  • MrPenguinMrPenguin BRMember

    For those who are still facing CS0246 error using Visual Studio on Windows, I found a way to solve it.

    Right click on Solution >> Manage NuGet Packages for Solutions, select the "Browse" tab and search for "Xamarin.forms", then install the first one Xamarin.Forms.

    It solved my problem!

  • DeyvidyBrazDeyvidyBraz USMember

    @MrPenguin said:
    For those who are still facing CS0246 error using Visual Studio on Windows, I found a way to solve it.

    Right click on Solution >> Manage NuGet Packages for Solutions, select the "Browse" tab and search for "Xamarin.forms", then install the first one Xamarin.Forms.

    It solved my problem!

    a resposta dele funciona (caso venha Brasileiro aqui procurando uma solução)

  • EhigiePaulEhigiePaul USMember

    I solved the problem by setting the right solution platform. E.g for UWP set it to x86, set IOS and Andriod solution platform.
    For me everything worked fine.

  • MdNaushadMdNaushad INMember ✭✭✭

    I was trying to solve the Error CS0246: The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) (CS0246).
    When I tried to see more into the warning section, I could see that the project name was exceeding the required length.
    Renaming the project solved the issue.

  • Hi. I have the same problem, when i build the ios project. I have Visual Studio 2017 version 15.5.1 and Xcode 9.2

  • PrinceHoffJrPrinceHoffJr USMember ✭✭

    starting to get the same issues using Visual Studio 2017. Apps has been working just fine now today... same issues everyone is having. I have the latest visual studio too. smh. Microsoft need to get rid of Xamarin Studio. Kill that project 100%. Everything should be done EASILY inside Visual Studio. Every tutorial online should be ONLY visual studio. Create a migration tool to move everyone's code from Xamarin Studio to Visual Studio.

  • PrinceHoffJrPrinceHoffJr USMember ✭✭

    For my solution, I had to uninstall Xamarin.Forms and reinstall Xamarin.Forms. it works now.

  • PrinceHoffJrPrinceHoffJr USMember ✭✭

    stopped working again.. lol and all I did was restart VS.

Sign In or Register to comment.