Search Unity

Porting to Windows 10 errors: "missing a using directive or an assembly reference"

Discussion in 'Windows' started by mengruts, Dec 16, 2015.

  1. mengruts

    mengruts

    Joined:
    Dec 16, 2015
    Posts:
    1
    Seems like an old circumstance but wondering why it's happening in Unity 5.2.3...
    Much appreciated if someone give me some light on how to resolve!

    Our environment: Unity project upgraded from 4.6.3 to 5.2.3 + Windows 10 + VS2015 Community.
    Build Settings chose Windows Store and Universal 10 SDK.
    Errors:
    Drop in replacement for System.Timers.Timer


    Assets\ClubSystem\Script\ClubApp.cs(345,4): error CS0234: The type or namespace name 'Process' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
    Assets\ClubSystem\Script\ClubApp.cs(490,3): error CS0234: The type or namespace name 'Process' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
    Assets\ClubMJ\Script\Protocol\Types\CMJ_RANK_LIST.cs(27,41): error CS0117: 'string' does not contain a definition for 'Copy'
    Assets\ClubSystem\Script\Login\LoginStageModel.cs(183,4): error CS0719: 'NetworkInterface': array elements cannot be of static type
    Assets\ClubSystem\Script\Login\LoginStageModel.cs(187,33): error CS0117: 'NetworkInterface' does not contain a definition for 'GetAllNetworkInterfaces'
    Assets\ClubSystem\Script\Login\LoginStageModel.cs(196,5): error CS0246: The type or namespace name 'PhysicalAddress' could not be found (are you missing a using directive or an assembly reference?)
    Assets\ClubSystem\Script\Login\LoginStageModel.cs(196,43): error CS1061: 'NetworkInterface' does not contain a definition for 'GetPhysicalAddress' and no extension method 'GetPhysicalAddress' accepting a first argument of type 'NetworkInterface' could be found (are you missing a using directive or an assembly reference?)
    Assets\ClubSystem\Script\Login\LoginStageView.cs(1235,3): error CS0234: The type or namespace name 'Process' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(966,44): error CS1061: 'XmlDocument' does not contain a definition for 'SelectNodes' and no extension method 'SelectNodes' accepting a first argument of type 'XmlDocument' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(994,51): error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'
    Assets\GameTower2\Gt2\User\WebConfig.cs(997,75): error CS1061: 'XmlDocument' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'XmlDocument' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(94,37): error CS1061: 'XmlNode' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'XmlNode' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(101,35): error CS1061: 'XmlNode' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'XmlNode' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(104,27): error CS1061: 'XmlNode' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'XmlNode' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(107,27): error CS1061: 'XmlNode' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'XmlNode' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(110,27): error CS1061: 'XmlNode' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'XmlNode' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(123,42): error CS1061: 'XmlNode' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'XmlNode' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\WebConfig.cs(130,44): error CS1061: 'XmlNode' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'XmlNode' could be found (are you missing a using directive or an assembly reference?)
    Assets\ClubSystem\Script\Maintain\MaintainStage.cs(82,13): error CS0234: The type or namespace name 'Process' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(1202,137): error CS0117: 'MethodBase' does not contain a definition for 'GetCurrentMethod'
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(242,30): error CS1061: 'Socket' does not contain a definition for 'Connect' and no extension method 'Connect' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(243,30): error CS1061: 'Socket' does not contain a definition for 'Blocking' and no extension method 'Blocking' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(344,26): error CS1061: 'Socket' does not contain a definition for 'Send' and no extension method 'Send' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(392,32): error CS1061: 'Socket' does not contain a definition for 'Available' and no extension method 'Available' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(397,46): error CS1061: 'Socket' does not contain a definition for 'Available' and no extension method 'Available' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(401,39): error CS1061: 'Socket' does not contain a definition for 'Receive' and no extension method 'Receive' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\ClubSystem\Script\Lobby\LobbyStage.cs(450,22): error CS0117: 'Muse' does not contain a definition for 'setSessionKeyUpdator'
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(1126,22): error CS1061: 'Socket' does not contain a definition for 'Close' and no extension method 'Close' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(1144,44): error CS0103: The name 'SelectMode' does not exist in the current context
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(1144,35): error CS1061: 'Socket' does not contain a definition for 'Poll' and no extension method 'Poll' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(1147,53): error CS0103: The name 'SocketFlags' does not exist in the current context
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(1147,39): error CS1061: 'Socket' does not contain a definition for 'Receive' and no extension method 'Receive' accepting a first argument of type 'Socket' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\GtLegacy\Network\Transmitter.cs(1155,38): error CS1061: 'SocketException' does not contain a definition for 'ErrorCode' and no extension method 'ErrorCode' accepting a first argument of type 'SocketException' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\User\ServiceEvent.cs(65,47): error CS1061: 'MemoryStream' does not contain a definition for 'GetBuffer' and no extension method 'GetBuffer' accepting a first argument of type 'MemoryStream' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Ishtar\Verifyer.cs(66,37): error CS1061: 'Type' does not contain a definition for 'IsPrimitive' and no extension method 'IsPrimitive' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Ishtar\Verifyer.cs(66,103): error CS1061: 'Type' does not contain a definition for 'IsEnum' and no extension method 'IsEnum' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\Types\ConnectTypes.cs(247,50): error CS0117: 'Environment' does not contain a definition for 'CurrentDirectory'
    Assets\GameTower2\Gt2\Serialization\Serializer.cs(49,43): error CS1061: 'Type' does not contain a definition for 'IsEnum' and no extension method 'IsEnum' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\Serialization\Serializer.cs(665,43): error CS1061: 'Type' does not contain a definition for 'IsEnum' and no extension method 'IsEnum' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\Serialization\Serializer.cs(1350,28): error CS1061: 'Type' does not contain a definition for 'IsEnum' and no extension method 'IsEnum' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\Serialization\Serializer.cs(1367,27): error CS0117: 'Type' does not contain a definition for 'GetTypeCode'
    Assets\Gt2Unity\Script\CommonComponent\Crash\CrashReporter.cs(158,60): error CS0117: 'Environment' does not contain a definition for 'Version'
    Assets\Gt2Unity\Script\CommonComponent\Debug\Scripts\DebugConsole.cs(333,13): error CS1061: 'Type' does not contain a definition for 'IsPrimitive' and no extension method 'IsPrimitive' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\Gt2Unity\Script\CommonComponent\Debug\Scripts\DebugConsole.cs(346,31): error CS1061: 'Type' does not contain a definition for 'IsGenericType' and no extension method 'IsGenericType' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\Gt2Unity\Script\CommonComponent\Debug\Scripts\DebugConsole.cs(394,31): error CS1061: 'Type' does not contain a definition for 'IsClass' and no extension method 'IsClass' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\Gt2Unity\Script\CommonComponent\Version\VersionProvider.cs(109,38): error CS1061: 'XmlDocument' does not contain a definition for 'SelectNodes' and no extension method 'SelectNodes' accepting a first argument of type 'XmlDocument' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\Serialization\Jsonlization.cs(52,39): error CS1061: 'Type' does not contain a definition for 'IsEnum' and no extension method 'IsEnum' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\GameTower2\Gt2\Serialization\Detail\ReflectionHelper.cs(27,58): error CS0121: The call is ambiguous between the following methods or properties: 'System.Reflection.TypeExtensions.GetMethod(System.Type, string, System.Reflection.BindingFlags)' and 'WinRTLegacy.TypeExtensions.GetMethod(System.Type, string, System.Reflection.BindingFlags)'
    Assets\GameTower2\Gt2\Serialization\Detail\ReflectionHelper.cs(135,36): error CS0121: The call is ambiguous between the following methods or properties: 'System.Reflection.TypeExtensions.GetField(System.Type, string, System.Reflection.BindingFlags)' and 'WinRTLegacy.TypeExtensions.GetField(System.Type, string, System.Reflection.BindingFlags)'
    Assets\GameTower2\Gt2\Serialization\Detail\ReflectionHelper.cs(153,42): error CS0121: The call is ambiguous between the following methods or properties: 'System.Reflection.TypeExtensions.GetProperty(System.Type, string, System.Reflection.BindingFlags)' and 'WinRTLegacy.TypeExtensions.GetProperty(System.Type, string, System.Reflection.BindingFlags)'
    Assets\ClubSystem\Script\Component\GameTransform\GameTransformModel.cs(114,25): error CS1061: 'XmlDocument' does not contain a definition for 'SelectNodes' and no extension method 'SelectNodes' accepting a first argument of type 'XmlDocument' could be found (are you missing a using directive or an assembly reference?)
    Assets\Gt2Unity\Script\CommonComponent\Event\EventManager.cs(182,9): error CS0103: The name 'Console' does not exist in the current context
    Assets\ClubSystem\Script\Component\Mail\MailView.cs(503,47): error CS1061: 'DateTime' does not contain a definition for 'ToShortDateString' and no extension method 'ToShortDateString' accepting a first argument of type 'DateTime' could be found (are you missing a using directive or an assembly reference?)
     
  2. GarthSmith

    GarthSmith

    Joined:
    Apr 26, 2012
    Posts:
    1,240
    Some namespaces can't be used on the Universal Windows Platform. Eg: Windows.Network.Sockets instead of System.Net.Sockets or Windows.Data.XML instead of System.XML.

    This means a lot of times you need to have two versions of some things, a Mono version or stub for the Unity Editor and a #if NETFX_CORE version for when it's being compiled with Microsoft's .NET.
     
    mengruts likes this.
  3. GarthSmith

    GarthSmith

    Joined:
    Apr 26, 2012
    Posts:
    1,240
    mengruts likes this.
  4. ckesterson

    ckesterson

    Joined:
    Aug 5, 2016
    Posts:
    4
    Hello!

    I'm getting the same error as your first, that the type or namespace "Process" could not be found. Was there a way to resolve this? I looked at the link Garth-Smith posted, and I didn't see System.Diagnostics listed, which I'm assuming means I can't use that in Unity? Is there a way around this though so that I can still open an .exe from inside my unity build?
    Thanks so much!
     
  5. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    You cannot launch a new process from Windows Store App directly, this is not allowed for security reasons. You have to use association launching. See here - http://docs.unity3d.com/Manual/windowsstore-assocation-launching.html
     
  6. ckesterson

    ckesterson

    Joined:
    Aug 5, 2016
    Posts:
    4

    @Tomas1856 that's really good to know, I was unaware of that, thank you so much for your reply. I read through that page and the links it has listed, but I think I'm looking for something different than this? I don't want to have a program that's launched as the default handler for a file type. I want to be able to run a program from the command line from inside my unity application, and then use the text results that are generated. Is there a way to do that with association launching? Or would I need something different?

    Thank you again for any help!
     
  7. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    I think the answer is no. Unless there is some desktop application that does that, but that would have to be installed separately. Windows Store App can't launch other app.
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    Aurimas is right...

    Can you explain in more detail, what are you trying to achieve, maybe there are other ways. For ex., you could call a function from external DLL using DllImport, and that would work on Windows Store Apps.
     
  9. ckesterson

    ckesterson

    Joined:
    Aug 5, 2016
    Posts:
    4
    I looked into using the DLL, and that was exactly what I needed. Thanks so much for your help!!