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. Dismiss Notice

Unable to build. CS0103 MSB3258 "using system" red

Discussion in 'Scripting' started by Rknudsen, Jul 19, 2016.

  1. Rknudsen

    Rknudsen

    Joined:
    Jan 22, 2013
    Posts:
    7
    Hey all. I've run into a snag that I've come to accept that I need some assistance with. I've spent the last couple of days trying to trouble shoot this issue. Its especially crippling because I'm unable to build my dlls.

    I'm currently working in Unity 5.3.3f1 using Monodevelop 5.9.6.

    We've tried uninstalling and installing xamarin and various versions of xamarin/monodev/gtk. We truthfully just dont understand or have experience with what is happening on our machines. Only one other person was able to compile successfully and we're looking into why that is. We figured it would be a good idea to confide in the community to see if we can get help fixing this.

    Specifically in monodevelop "using System" "System.Reflection", "System.Collections", "UnityEngine.SceneManagement", & "System.Type" are highlighted in red.

    We've also checked to make sure our references are stored in the correct directory that monodevelop is looking for them in.

    Really I'm at a loss. I'm not sure what I should try next.
     
  2. kru

    kru

    Joined:
    Jan 19, 2013
    Posts:
    452
    What is the specific error that unity is displaying in the console?

    My first thought is that you're missing semi-colons, or that those statements may be occurring at the wrong place within the file.
    Code (csharp):
    1. // First line of file
    2. using System;
    3. using System.Reflection;
    4. using System.Collections;
    5. using UnityEngine.SceneManagement;
    6. using System.Type;
    7.  
    8. class SomeClass { ...
    This is how the file should look. Using statements are above the first class declaration, and properly terminated.

    If all is well syntax-wise, then the project is missing references to the system and unityengine assemblies. This means that Unity is not building the project file correctly. Try creating an entirely new project, in a completely new directory (create it on another drive or partition if you can). Create some scripts in that new project and see if they suffer the same issue. If not, then at least know that the problem is isolated to one project.
     
  3. Rknudsen

    Rknudsen

    Joined:
    Jan 22, 2013
    Posts:
    7
    okay, I've double checked and created a new c# solution project in my documents folder. I've attached a screenshot. Also another issue that I've discovered is that I cannot "browse" in the reference window to add new references like unity engine......I also cannot use the open dialog in monodev. I have to right click on a solution and open with...

     
  4. jimroberts

    jimroberts

    Joined:
    Sep 4, 2014
    Posts:
    560
    You shouldn't be manually adding references when writing Unity scripts. External libraries are considered plugins in Unity. Please specify which OS you are working on.
     
    Last edited: Jul 20, 2016
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,181
    If Unity's .dlls isn't resolved, that's usually a symptom of a corrupted library. You can either delete your library folder, or right click any asset and select "reimport all".
     
  6. Rknudsen

    Rknudsen

    Joined:
    Jan 22, 2013
    Posts:
    7
    We're working with windows 7. If not adding references through monodev, what is the appropriate method for adding references to a solution?
     
  7. jimroberts

    jimroberts

    Joined:
    Sep 4, 2014
    Posts:
    560
    The references should be added automatically when using Monodevelop and/or Visual Studio through Unity. Can you check your "~\Program Files\Unity\Editor\Data\Mono\lib\mono\unity\" folder and make sure it has System.dll?
     
  8. Rknudsen

    Rknudsen

    Joined:
    Jan 22, 2013
    Posts:
    7
    Makes sense. Maybe I'm not opening the solution in the correct manner? I usually open it from the file system.
    Whats weird about all of this is another person on our team is able to compile just fine using the same steps myself and another have been attempting...
     
  9. Rknudsen

    Rknudsen

    Joined:
    Jan 22, 2013
    Posts:
    7
    Hmmmmm, that could be. I'm sure I have a lack of understanding here since typically I'm one of the artists working on our projects. AFAIK, our code is compiled into dlls and unity shouldnt really be touching it. its all compiled in monodev. so I guess I'm not sure how the library in the unity project would be affecting the references. I'll have to look into that further. Thank you though. we're kind of at our wits end with monodevelop and any lead helps tremendously.
     
  10. jimroberts

    jimroberts

    Joined:
    Sep 4, 2014
    Posts:
    560
    I'm not sure if this is relevant but can you check if you have the .NET Core SDK installed? It will be at "~\Program Files\Microsoft SDKs\NETCoreSDK\" or "~\Program Files (x86)\Microsoft SDKs\NETCoreSDK\". Someone had this same problem a few days ago and ended up just installing Visual Studio 2015 Community which fixed the issue.
     
    Last edited: Jul 20, 2016
  11. Rknudsen

    Rknudsen

    Joined:
    Jan 22, 2013
    Posts:
    7
    Hmmm, Yeah it looks like I have .net core sdks installed. If I can help it I'd like to stay in monodevelop. We've tried switching to visual studio and the result is a bulk of errors output into the log. Just a lot more work to resolve. Its just frustrating because we know the code works. We've used it before and we have one person that can compile, but that isnt the best because the rest of us need to work on the code as well. It has to be something with our machines or something with how our monodev is configured. We have said person bringing down their machine to let us compile on, but its not an ideal situation. We should be able to compile on our machines. :C
     
  12. jimroberts

    jimroberts

    Joined:
    Sep 4, 2014
    Posts:
    560
    Did you try creating a completely new project and script to see if the error persists like kru suggested?
     
  13. Rknudsen

    Rknudsen

    Joined:
    Jan 22, 2013
    Posts:
    7
    yeah, there is a reply to that just a ways up. maybe If I show you guys the hierarchy of how our code is structured in the file system that may help.

    So it goes like this (From what I've seen its not a very standard way of organizing the code with unity, but it was intended for back in unity4 and older so that monodev/unity wouldn't try to compile the code on its own. it would be done manually..its a very niche case):

    -project root
    ------monodev
    ------------.sln (this is where code gets compiled)
    ------unity (this is the unity project)
    ------------assets
    ------------------scripts (then we place our dll's here)

    If I just create a new unity project and create a .cs file and open with visual studio everything builds fine, but this isnt ideal as we need our solution to be stored in the monodev folder outside of the unity project we do not want unity to try and compile this:
     
    Last edited: Jul 21, 2016
  14. jimroberts

    jimroberts

    Joined:
    Sep 4, 2014
    Posts:
    560
    It sounds like you want to use Managed Plugins... Is there some reason you don't want Unity to compile the code?