Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

MonoDevelop error CS0103 - Now fixed.

Discussion in 'Editor & General Support' started by DarylB, Feb 1, 2016.

  1. DarylB

    DarylB

    Joined:
    Dec 28, 2015
    Posts:
    5
    I was working away in Unity, when all of the sudden MonoDevelop-Unity started highlighting the "UnityEngine" in the using declaration, and everything in the UnityEngine package in the file in pink, with the error:

    "Error CS01013: The name 'UnityEngine' does not exist in the current context."

    Any idea what broke, and how I can fix it?
    I've searched this forum and the unity-answers site to no avail.
     

    Attached Files:

  2. DarylB

    DarylB

    Joined:
    Dec 28, 2015
    Posts:
    5
    I should have mentioned: my code also builds and runs fine.

    Also, in the "Assemby-CSharp" part of the "Solution" in MonoDevelop, "UnityEngine" is present and doesn't show any errors.

    I'm really at a loss here.
     
  3. DarylB

    DarylB

    Joined:
    Dec 28, 2015
    Posts:
    5
    This is fixed now.

    I noticed when I rebuilt the project in MonoDevelop that it was complaining about an "xmlns" element that shouldn't be in the file named "..". When I tried to click on the error it told me ".. is a directory". -- Correctly so.

    On a hunch, I checked the project folder (in Windows) and found there were two .csproj files; one named after my project -- last dated the exact time I started experiencing this problem -- and another named "Assembly-CSharp.csproj" which was dated today/now. So I assume Unity had created a new default project file and switched to that one on that date, and that started giving me the weird error.

    THE FIX:
    I simply deleted the file named "Assembly-CSharp.csproj", restarted Unity, it created a new "Assembly-CSharp.csproj" file, and when I opened MonoDevelop everything works now.
     
    Firemaw, Cool_Flow and mgsrizqi like this.
  4. DarylB

    DarylB

    Joined:
    Dec 28, 2015
    Posts:
    5
    FYI, I think what causes this is editing the Project > Assembly-CSharp options, and changing the Source Code > Code Formatting rules.
     
    Navneet95 and mgsrizqi like this.
  5. Cool_Flow

    Cool_Flow

    Joined:
    Apr 14, 2013
    Posts:
    21
    Thank you, I was looking everywhere for why this was happening.
     
  6. ardiawanbagusharisa

    ardiawanbagusharisa

    Joined:
    Oct 26, 2015
    Posts:
    9
    This might be old, but thank you for sharing. This really helpful.
     
  7. Lamer80

    Lamer80

    Joined:
    Apr 1, 2017
    Posts:
    2
    jose-tarallo and Lukebox like this.
  8. lnlo

    lnlo

    Joined:
    Apr 21, 2017
    Posts:
    1
    On my side it came from ZoneAlarm that did not have access to Internet. i remove the restriction and everything went back to normal
     
    nickGTC likes this.
  9. hypnoslave

    hypnoslave

    Joined:
    Sep 8, 2009
    Posts:
    427
    Hey there, sorry to resurrect an old thread, but I couldn't find a solution to this and stumbled accross one myself. So if anyone finds this thread...

    I deleted my "Assembly-CSharp" files in my project directory, and reloaded my project. I then right clicked on the CSharp.csproj and opened it with monodevelop. That gave me an error, surprisingly, but I opened it again from monodevelop's recent files and it said that it loaded the solution. After that, this problem went away.
     
  10. orihq

    orihq

    Joined:
    May 25, 2016
    Posts:
    7
    In Mono Develop;

    Project > Assembly-CSharp Options > Build > General > Target Framework > Mono/.NET 4.5
     
    jasonnxg likes this.
  11. ToastHatter

    ToastHatter

    Joined:
    Nov 11, 2016
    Posts:
    53
    If i click on project, Assembly CSharp Options is not an option for me
     
    Pancar likes this.
  12. Artmarab

    Artmarab

    Joined:
    Feb 9, 2017
    Posts:
    4
    For anyone that ends up here looking for an answer.
    I had the same issue and discovered the antivirus had blocked MonoDevelop.exe Once solved, everything went back to normal.
     
  13. jose-tarallo

    jose-tarallo

    Joined:
    May 4, 2017
    Posts:
    1
  14. imdadahmadmian

    imdadahmadmian

    Joined:
    Oct 13, 2017
    Posts:
    3
    Found this error after installation of new windows. This problem is due to the target framework that the monodevelop uses to find the required libraries and framework. The solution is
    1) Install the .NET frame work.
    or go to the following location in the monodevelop and see if there are any .NET frame work available,if so select one. If there are more than one then select other and check. This work for me.
    Project --> Assembly-CSharp Options --> Build --> General --> Target Framework --> Mono/.NET 4.0.
     
  15. SoftPluse

    SoftPluse

    Joined:
    Jul 7, 2018
    Posts:
    1
    In Mono Develop;

    Project > Assembly-CSharp Options > Build > General > Target Framework > Mono/.NET 4.5

    @orix_ Thanks its work for me
     
  16. Navneet95

    Navneet95

    Joined:
    Sep 25, 2018
    Posts:
    1
    thank you