Search Unity

Can't build UWP game in Visual Studio

Discussion in 'Windows' started by Hertzole, May 8, 2020.

  1. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hello

    I'm having some massive troubles building my game as a UWP app. Everything is fine in Unity and it spits out the solution file. But every time I try to build it, no matter if I try with VS 2017 or 2019, I get the same errors:
    "The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application."
    and
    "cannot open input file 'game\build\bin\x64\Master\GameAssembly.lib'"

    Now you're probably thinking "just download .NET Framework 4.0" and I did too. I already had it installed and redownloading it did not help. I literally ticked all the .NET Framework boxes I could find in the Visual Studio installer. I also have .NET desktop development, Desktop development with C++ and Universal Windows Platform development all installed in Visual Studio.

    I can build UWP apps by themselves already. It's only the Unity game that is the problem. It's not something specific to my project either. I created a new project and it's the same result. It may be related to the 2020.2 alpha but I doubt it. Either way, that's the version I use for building.

    I have no clue what to do about this and any help is appreciated!
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Can you paste contents of the "Output" Window in Visual Studio after the build fails?
     
  3. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Sure thing! It isn't very long but this is all I got.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    I am extremely confused about that error. Could enable verbose build output (TOOLS -> Options -> Projects and Solutions -> Build and Run -> MSBuild project build output verbosity -> Set to detailed -> OK) and paste the output again?
     
  5. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Sure thing. Since it's rather long now, I've posted it on pastebin instead. https://pastebin.com/8k5tz5yF
    I hope it helps!
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Honestly, I've no idea why it is even looking for it. Could you go to Visual Studio Installer, press modify your installation and show the installed "individual components"?

    Secondly, I've noticed you're using a "preview" version of Visual Studio. Which version is it?
     
  7. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Sure thing, again!
    Here are ALL my installed individual components, just to be sure.
    And as you can see in the title bar, the preview version is 16.6.0 preview 6. But the same error also occurs on VS 2017 with pretty much the same components.
     
  8. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    705
    FWIW

    I'm building for UWP\IL2CPP with the attached (minimal) config using VS Community 2019 (16.5.4)
     

    Attached Files:

  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    The only thing I can think of right now is that your VS installation is corrupt. We don't even use .NET Framework when building generated VS project, so that fact that it's requiring it means that something is very off. Furthermore, you've actually installed what it asks for and it will still not work.

    I recommend full VS uninstallation (including uninstalling components from Add/Remove programs once VS is removed) and then trying installing it again. Fingers crossed that will help.
     
  10. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    I'll reinstall VS 2019 and report back later when I have the time. But I gotta ask, do I really need VS 2017 to make UWP builds? When trying to build in Unity without it, it just complained I didn't have VS 2017. Is this intended or is it a bug?
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    No, you don't need VS 2017. How exactly did Unity complain?
     
  12. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    It said I needed to have 2017 or greater installed and just said no version was installed. I guess it didn't recognize my preview version then.
     
  13. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Apologies! I just realized it was Burst complaining about the 2017 thing.
     
  14. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    That sounds like a bug... It should be able to pick up VS 2019. If it doesn't could you report it?
     
  15. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    I've reported the bug and the case is 1246735. Honestly not sure how reproducible it is but I tried and included a video of it.
    Also regarding the main issue of the topic: I can now build UWP games after a full reinstall. I was dreading doing it because VS sucks at backing up all my settings.Thanks for the help!