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

Could not find System.Core

Discussion in 'Windows' started by iusInnovation, Sep 18, 2013.

  1. iusInnovation

    iusInnovation

    Joined:
    Sep 18, 2013
    Posts:
    6
    Hello,

    I have been trying to build our iOS/Android projects as Windows Store Apps with mixed success. The first project works well but while the second one builds fine it runs into an exception every frame. I checked the log file created and find the following:

    Exception: The type initializer for 'UnityScript.Lang.UnityRuntimeServices' threw an exception.
    InnerException: Could not load file or assembly System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e or one of its dependencies. The system cannot find the file specified.
    AdditionalInfo:<No Data>
    at UnityScript.Lang.UnityRuntimeServices.GetEnumerator(Object obj)

    at StaticController.Update()

    at StaticController.UnityFastInvoke_Update()​

    The application doesn't crash but the same error is present in other objects during update which disables most of the functionality, can't click buttons etc.

    Both projects also get some strange warnings during build if i set the build output verbosity to detailed in visual studio:

    There was a conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e".
    1> "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it had a higher version.​

    The same warnings are present in both projects but the exception only happens in one of them. in addition to mscorlib, the same warning is shown for System and System.Core. It looks like this could be the problem but then how come one of the projects still work?

    I'm using windows 8.1 and Visual Studio 2012, could this be an issue?

    Any ideas or suggestions are welcome.
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,664
    Which SDK are you using?
    Visual Studio 2012 has only 8.0 SDK, so you can not select 8.1 in build settings.
     
  3. iusInnovation

    iusInnovation

    Joined:
    Sep 18, 2013
    Posts:
    6
    I'm not very experienced with visual studio, where can i check which sdk is used?
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,690
    Are you using JS, if so, it's not supported in 4.2
     
  5. iusInnovation

    iusInnovation

    Joined:
    Sep 18, 2013
    Posts:
    6
    I am using JS yes. Are you saying it is not supported in unity 4.2 when building a Windows Store App?
     
  6. iusInnovation

    iusInnovation

    Joined:
    Sep 18, 2013
    Posts:
    6
    I made some progress with the specific exception. Using for-loops of the following syntax seemed to be the problem:

    Code (csharp):
    1. for(object in objects)
    2. {
    3.     object.Function();
    4. }
    using a normal for-loop fixed it:
    Code (csharp):
    1.  
    2. for(var i = 0; i < objects.Count; i++)
    3. {
    4.     objects[i].Function();
    5. }
    Maybe it can help someone else, thanks for your input!
     
  7. Phil-AV

    Phil-AV

    Joined:
    Jul 9, 2012
    Posts:
    57
    Whilst other platforms do, Windows Store currently does not support JavaScript. You're going to have to convert over to C# to publish to the Windows Store.
     
  8. iusInnovation

    iusInnovation

    Joined:
    Sep 18, 2013
    Posts:
    6
    I'm not sure what you mean exaclty. I have successfully built one of our projects that is using JavaScript and have it running on a Surface RT and HP ElitePad. Do you mean the actual publishing?
     
  9. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,664
    In 4.2 JavaScript is unreliable on Windows Store Apps. Some things may work, others not.
     
  10. iusInnovation

    iusInnovation

    Joined:
    Sep 18, 2013
    Posts:
    6
    Aha, I see, thanks. That explains the randomness of the exceptions and some things not working properly. I'll have to convert some scripts or wait for an update i guess.