Search Unity

Cant install Microsoft.Xbox.Live.SDK.WinRT.UWP NuGet Package

Discussion in 'Windows' started by SkobbejakGames, May 28, 2017.

  1. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Hi,

    I am trying to port our Xbox One game to Windows Store, and I have downloaded the Windows 10 SDK, the Xbox Live SDK and necessary tools and add-ons for Unity. I have gotten my game to build out from Unity and the solution to build in Visual Studio and the game runs.

    I am trying to add Xbox Live functionality now though and I am following the Xbox Live SDK documentation but I cant seem to install the necessary NuGet Packages though when I try to install the Microsoft.Xbox.Live.SDK.WinRT.UWP NuGet Package as it just gives me the following error when I try to install it inside the NuGet Packet Manager inside Visual Studio:

    Severity Code Description Project File Line Suppression State
    Error Unable to load package 'Microsoft.Xbox.Live.SDK.WinRT.UWP.Netcore.Release'. 0

    Please any help on the matter would be immensely appreciated.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Don't add that nuget package through VS. Instead, extract it with 7-zip (or other unzipping software) and put the .winmd and .dll files into your Unity project. Unity will then correctly configure the resulting VS project to use that package.
     
    SkobbejakGames likes this.
  3. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Thanks so much for the heads up, really appreciate it.
     
    Last edited: May 29, 2017
  4. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok, cool it seems to work now. However, I seem to get an error now which halts the game completely. The error is concerned with the SignIn process and gets triggered in the XboxLive script I created to handle my game's specific XboxLive functionality. This error gets thrown as soon as the SignIn() method gets called in my XboxLive script:

    Unhandled exception at 0x00007FFC11E5D1B4 (twinapi.appcore.dll) in nVerloreVerstand.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0000000EB25FE170, 0x0000000000000001).

    This is what the SignIn() method looks like:

    async void SignIn()
    {
    SignInResult result = await m_user.SignInAsync(UIDispatcher);

    if (result.Status == SignInStatus.Success)
    {
    m_xboxLiveContext = new Microsoft.Xbox.Services.XboxLiveContext(m_user);
    debugText += "\n User signed in: " + m_xboxLiveContext.User.Gamertag;
    }
    }

    I am using the example script that is included in the Xbox Live SDK documents under the section "How to add Xbox Live support to a Unity UWP project", I still need to modify it towards my game's specific needs but I just want to get the basics running properly first.

    Ive followed all of the steps detailed in the documents how to connect everything, but something seems to wrong or missing, Im just not sure what though.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Is xboxservices.config file copied to the output directory correctly? IIRC lack of that file causes the exception you're seeing.
     
  6. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I copied it to the root Output folder that Unity builds out to (where the main project sln file is located), is there perhaps a specific place it needs to be placed in?

    What I do indeed notice is that when I open the xboxservices.config file I get the following errors inside of it:

    Severity Code Description Project File Line Suppression State
    Error XML document must contain a root level element. Miscellaneous Files F:\VerloreBackup\UWP\Mind\Build\nVerloreVerstand\xboxservices.config 5

    Severity Code Description Project File Line Suppression State
    Error Invalid token 'Text' at root level of document. Miscellaneous Files F:\VerloreBackup\UWP\Mind\Build\nVerloreVerstand\xboxservices.config 1

    I followed the Documentation step by step to enter the details and just have my TitleId and Primary ServiceConfigId set:

    {
    "TitleId" : My Title ID Here,
    "PrimaryServiceConfigId" : "My PrimaryServiceConfigId Here"
    }
     
    Last edited: May 31, 2017
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Did you add it to the project itself? VS does not automatically scan for files in the folder.
     
  8. matt33315

    matt33315

    Joined:
    Mar 28, 2014
    Posts:
    94
    Not sure if this problem is 100% the same as what I faced but I found that the nuget package didn't actually work.

    I installed it but then faced similar errors when trying to sign in. In the end I tried adding the Xbox live projects directly as project references (the documentation has steps to do this).

    After doing this then the exact same login code worked fine.
     
  9. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok I managed to solve the errors inside xboxservices.config (it was saved as an XML Configuration not a JSON file).

    However this didnt fix the issue though.

    @Tautvydas-Zilys Yes I just noticed that the xboxservices.config does get included in the project itself (I added it by dragging it into VS and placing it under the Main UWP app (not under the ROOT solution or the CSharp Assembly or the firstpass). I moved the one located in the ROOT build folder outside of the entire project to avoid confusion. Yet the problem still persists. When the solution get built and deployed it is copied to the UWP app's folder.

    @matt33315 I tried adding the references directly to the UWP app but when I try to add either of the .vcxproj files, I just get an error window saying that the file reference could not be added due to it either not being accessible or not being a valid Assembly or COM component.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you attach the contents of the main UWP app project files (.vcxproj if you use IL2CPP, .csproj if you use .NET scripting backend)?

    In that file properties, you need to make sure that the type is set to "Content" and copy is set to "Copy If Newer".
     
  11. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I have attached the .csproj file.

    I have set the File Properties so that the type reflects Content and the copy is set to Copy If Newer, however this doesnt seem to make a difference. I couldnt set any properties directly on the .csproj file there is a Child titled Properties and under that there are items located, AssemblyInfo.cs and Default.rd.xml, and I set them both to Content and Copy If Newer.

    I also tried adding the source objects directly (instead of references) by dragging them in under the UWP app as I did with xboxservices.config and I also tried to include them in the Unity project and build out the project with them included, but neither of these attempts seemed to solve the issue either.
     

    Attached Files:

  12. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I am attaching some screenshots as well to show you what the UWP app contents look like in Visual Studio.

    AssemblyInfo.png Default_rd_xml.png

    I also managed to install the Nuget to the project in the Nuget Manager by installing an older version, I noticed that the XboxLiveSDK that I have downloaded from GDNP isnt the latest version, Im not sure if this might have something to do with the issues Im having. Ever since installing the Nuget package (UWP.WinRT one) It seems to get stuck at a different error now before even reaching the SignIn process.

    The error occurs in the XboxLiveUser() method located in SafeTypes.g.cs and is connected with the Microsoft.Xbox.Services.System.XboxLiveUser class. Here is the error:

    Unhandled exception at 0x00007FFB5984D5B8 (ucrtbase.dll) in nVerloreVerstand.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.

    And here is the code that triggers the error:

    this.__AttachAndRelease(retval);
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I see two issues:

    1. At no point your .csproj file your sent me references xboxservices.config file.
    2. You misnamed xboxservices.config file. It should not have a ".json" extension. It's just "xboxservices.config".
     
  14. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok I changed the xboxservices file to only be a .config, although the issue still remains.

    As for point 1. Im not sure how to add xboxservices as a reference, I keep getting this same error window saying that the file reference could not be added due to it either not being accessible or not being a valid Assembly or COM component when I try to use "Add Reference".

    I ended up just dragging it into VS under the UWP app as a child, I am attaching a picture to help demonstrate.

    Im not sure if there is a specific way to reference the xboxservices.config file.
     

    Attached Files:

  15. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Put this snippet inside your .csproj file under any <ItemGroup>:

    Code (csharp):
    1.     <Content Include="xboxservices.config">
    2.       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    3.     </Content>
     
  16. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok awesome! That fixed it. Thanks so much!

    I seem to have a little trouble signing in, though. I am getting the following error when trying to Sign-In:

    "We are unable to sign you in to Xbox Live at the moment. Try again in a while."

    With the following error code: 0x87DD0005

    I am using a Dev Account that I created in XDP and still used for Xbox One development. I have my PC set to my assigned .0 Sandbox (Im not sure if my assigned .99 Sandbox might be a better option though). My Dev account region is set up for USA I think and my PC is set to my local country (South Africa) so Im not sure if that might have an effect.

    Either way it seems to be connected to the account itself not the coding.
     
  17. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I can see that my Dev account does indeed sign in, its when I hit "Let's Play" that I get the above error.
     
  18. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok I seem to get a few thousand errors out of the blue now when trying to build in Visual Studio, I didnt change anything so Im not sure where these issues are coming from it must be from Unity itself though as it persists even after deleting the build and rebuilding from Unity. Im attaching a picture that shows some of the errors although they all seem to be related.
     

    Attached Files:

  19. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    ...did you update your Visual Studio recently?
     
  20. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Not that I know of. I had to redo the whole process as I accidentally to deleted the whole process I then got stuck at the first SignIn error again and then after a few more builds I started getting this error. The only thing that I installed/updated for Visual Studio was the NuGet package that I installed via the Nuget Manager as I couldnt get the project to run and wasnt sure if it was the Xbox Live Nuget that needs to be updated.
     
  21. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Those errors mean that NuGet packages aren't being restored for some reason. Try right clicking on the solution in VS and doing "Rebuild All". If that doesn't help, check if these checkboxes are unchecked by any chance:

    upload_2017-8-1_15-59-27.png
     
  22. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ah that explains it. I ticked those boxes off for the NuGet Package Manager. Whe weird thing is Im still getting the SignIn error from earlier:

    Unhandled exception at 0x00007FFC11E5D1B4 (twinapi.appcore.dll) in nVerloreVerstand.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0000000EB25FE170, 0x0000000000000001).

    I followed the exact same steps for the xboxservices.config and adding it as well as all the other stuff.
     
  23. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Sorry, forgot to add the new .csproj file and Im adding a pic of the xboxservices.config file as well. Please any help or advice on the matter would be greatly appreciated.
     

    Attached Files:

    • Test.zip
      File size:
      580.7 KB
      Views:
      430
  24. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    What's the callstack for that exception?
     
  25. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I*m attaching 2 pics to show the call stack for both exceptions as well as the code itself.
     

    Attached Files:

  26. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    ClassNotRegistered exception usually means you're missing an implementation DLL. Did you copy all dependent files on your unity project? Last time I checked, those files were Microsoft.Xbox.Services.winmd, Microsoft.Xbox.Services.dll and cpprest140_uwp_2_8.dll.
     
  27. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I only have Microsoft.Xbox.Services.winmd in my project where are the other 2 files located in the SDK?
     
  28. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    They should be right next to the .winmd file in the Xbox Live SDK.
     
  29. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    The only other files present next to the winmd is the .nupkg NuGet Packages. I can see that the respective Nuget that I have to use contains .pdb and .lib files for Microsoft.Xbox.Services and cpprest140_uwp_2_8 but no .dlls
     
  30. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I also have the appropriate NuGet Package extracted into my project (Microsoft.Xbox.Live.SDK.Cpp.UWP.2016.12.20170107.01 or at least I think its the correct one, Im not sure if I should be using the WinRT one instead). Although it still doesnt seem to make a difference.
     
  31. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I am seeing the following in the SDK documentation:

    1. For C++ based projects for targeting either XDK or UWP must also:
      • Include {SDK source root}\xsapi.staticlib.props in your project. You can do this in Visual Studio, by clicking on View | Other Windows | Property Manager, and then in the Property Manager tab, right click your project and choose “Add Existing Property Sheet” and select the xsapi.staticlib.props.
      • Include {SDK source root}\Include\xsapi\services.h header in your project’s source

        Im wondering if this might not be the cause. Im trying to add the xsapi.staticlib.props file using the method describe but I cant find the “Add Existing Property Sheet” option and my Property Manager tab is empty no matter what I select. Im also not to sure how the services.h file must be included the same way as xboxservices.config or in a specific manner.
     
  32. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok, Im still sitting with the same issue but I think I might be moving closer to finding the cause. I inserted the two lines into App.xaml.cs mentioned by @tonemcbride in the following thread:

    https://forum.unity3d.com/threads/debugging-uwp-crash-on-certain-pcs.479366/#post-3126591

    I then switched to Debug instead of Master or Release and Im getting a different error now, which seem to give a little bit more info and are still related to the same SignIn issue (I am attaching a picture that illustrates the error and its callstack). Although I only got this error once now when I try to play the game just freezes and the VS debugger crashes with the following message in the out put:

    The program '[12396] nVerloreVerstand.exe' has exited with code -1 (0xffffffff).

    I also just want to check if the xboxservices.config file is supposed to be giving the following errors:

    Severity Code Description Project File Line Suppression State
    Error Invalid token 'Text' at root level of document. nVerloreVerstand F:\VerloreBackup\UWP\Mind\Build\nVerloreVerstand\xboxservices.config 1

    Severity Code Description Project File Line Suppression State
    Error XML document must contain a root level element. nVerloreVerstand F:\VerloreBackup\UWP\Mind\Build\nVerloreVerstand\xboxservices.config 5
     

    Attached Files:

    Last edited: Aug 3, 2017
  33. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    That's the same error you were getting before.

    Extract those .nupkg files with your favorite unzipping program (I personally like 7-zip). Those files should be there somewhere. And I guarantee that you need them.

    And yeah, I believe you are supposed to be using WinRT package, because the CPP package is meant for C++ projects.
     
    SkobbejakGames likes this.
  34. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok cool I didnt know I was supposed to use the WinRT version, apologies. I can see that the .dll files are present in the WinRT NuGet package, although Im not sure if I should use the native or the netcore version.

    Do I just copy the .dll files and the winmd to the Assets folder or do they need to be somewhere specific like Plugins?
     
  35. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Native and NetCore versions are the same as far as I know. It doesn't matter what folder it goes in your project, but make sure they're configured correctly in the plugin inspector.
     
    SkobbejakGames likes this.
  36. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok Awesome! It seems to work now I copied them over to my Assetes folder and I can finally get past the error and the SignIn process is happening again. However I seem to be getting trouble now with the Sign In process for my account and it tells me:

    "The application requesting authentication tokens is either disabled or incorrectly configured"

    Which seems to be an issue on how its set up on the Windows Dev Center as I do have my PC set to the right dev Sandbox that I use for our Xbox One development and I am using a Dev account with access to that Sandbox. The weird thing is that it worked a few days ago but now I can see in the Windows Dev Center that the Xbox Live Service isnt enabled.

    Im trying to contact ID@Xbox to get a bit more help on the situation.

    Thanks so much for all the help so far, I truly appreciate it :) . I will let you know if I run into any other issues
     
  37. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    I can see that there are specific Sandboxes that you create in the Windows Dev Center for your app when starting submission, leading me to believe that I shouldnt use the same Sanboxes as the ones for Xbox One.

    However, after switching my PC to the new Sandbox none of my Dev accounts want to connect and I get the following error when trying to sign in:

    "Your account doesn't match your dev environment
    If you're in the right sandbox and environment, switch to a Microsoft account for that sandbox. To keep using this account, change the registry's sandbox and environment. (%1)"

    Is there somewhere specific that I need to give my Dev Accounts access or that I need to create new accounts. Please any help on the matter would be greatly appreciated.
     
  38. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok, I just managed to find the section where I can create dev accounts.

    Although Im still getting the following error when I try to sign in with the the newly created dev accounts:

    "The application requesting authentication tokens is either disabled or incorrectly configured"

    Which leads me to believe that the Xbox Live service needs to be activated for the app first.
     
  39. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok, after Associating my App with the Store again, I seem to be getting a different error when trying to sign in:

    "Your account doesn't match your dev environment
    If you're in the right sandbox and environment, switch to a Microsoft account for that sandbox. To keep using this account, change the registry's sandbox and environment. (%1)"

    It doesnt matter which Sandbox or Dev Accounts I use (wither it be our Xbox One XDP Sandboxes/DevAccounts or our Windows Dev Center Sandboxes/DevAccounts) we always get one of two errors, either the one above or :

    "The application requesting authentication tokens is either disabled or incorrectly configured"
     
  40. SkobbejakGames

    SkobbejakGames

    Joined:
    Jun 3, 2016
    Posts:
    396
    Ok, cul managed to fix it. Emailed ID@Xbox and they informed that I should us my XDP .0 Sandbox (not the .99 one) and Dev Accounts. I also just needed to change my TitleID in my xboxservices.config file accordingly and now everything is working fine. Thanks again for all the help @Tautvydas-Zilys , really appreciate it :)