Forum Visual Studio

Core.PhonewordTranslator.ToNumber compilation error

System

Microsoft Visual Studio Premium 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Version 4.5.51641

Xamarin.Android 4.10.02014 (4b53fbd0)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS 1.10.39 (e0334707)

Visual Studio extension to enable development for Xamarin.iOS

Application

Created an "Android Application" using visual studio wizard

Problem

Trying to use Core.PhonewordTranslator.ToNumber in the main activity

I get compilation error

"The name 'Core' does not exist in the current context".

Posts

  • Sorry, my bad. The namespace Core made me think that this was some sort of system provided class that I was missing. I figured out that I've to write this.

  • JasonIpockJasonIpock USMember

    For those people needing more information, this issue can be caused by not renaming the namespace in the PhoneTranslator.cs file to "Core".

  • NkechiNnajiNkechiNnaji USUniversity ✭✭

    If you followed the sample IOS code word for word, then you would need to make the changes stated in the earlier answers. If (like me) you are using different names other than what the sample code uses, the "Core" in that line of code generating error is the name of the namespace in your project. So, you do not have to rename your namespace to "Core" to get the iOS sample code work. All you need to do is change that word "Core" to the namespace you originally have or are using in your project.

    In my PhoneTranslator.cs, my namespace is MyApp. So I changed "Core.PhonewordTranslator.ToNumber" to "MyApp.PhonewordTranslator.ToNumber"and I didn't get any errors.

  • TonyAdamsTonyAdams USMember
    edited October 2015

    I made a rookie mistake while following the quick start guide and named the namespace Phoneword_ios (should have been Phoneword_iOS). Once I renamed the namespace (fixing the case) in my PhoneTranslator.cs file, everything started working properly.

  • AlirezaToosiAlirezaToosi USMember

    I had this problem too, then I added using Core; to top of my MainActivity.cs and It have worked correct.

  • sorry i still get anything

  • fasi1208fasi1208 PKMember

    Still can't able to solve this issue

  • JoshGrafJoshGraf USUniversity

    I ran into this issue because I had created 'PhonewordTranslator.cs' outside of the 'Phoneword (Portable)' project. I was able to resolve it by moving 'PhonewordTranslator.cs' into that project.

  • otai_gotai_g MYMember

    fucking shit.

    the tutorial at website are tricky. u need to change a little bit code before it can run.

    just replace this line:

    translatedNumber = PhonewordTranslator.ToNumber(phoneNumberText.Text);

    with this one

    translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);

  • @JoshGraf said:
    I ran into this issue because I had created 'PhonewordTranslator.cs' outside of the 'Phoneword (Portable)' project. I was able to resolve it by moving 'PhonewordTranslator.cs' into that project.

    This worked for me. I had inadvertently added this file to the Solution. Step 14 clearly says 'In Solution Explorer, right click on the Phoneword project' and select Add > New Item...:'

  • @JoshGraf said:
    I ran into this issue because I had created 'PhonewordTranslator.cs' outside of the 'Phoneword (Portable)' project. I was able to resolve it by moving 'PhonewordTranslator.cs' into that project.

    This worked for me. I had inadvertently created the file at the solution level. Step 14 clearly says 'In Solution Explorer, right click on the Phoneword project and select Add > New Item...:'

Sign In or Register to comment.