Jump to content
Sign in to follow this  
  • entries
    5
  • comments
    0
  • views
    695

Resolving build issues for UWP packages with Unity

SimonDarksideJ

806 views

Image result for visual studio tools for unity

If you are building games and projects in Unity and targeting the Universal Windows Platform (UWP), you may have noticed than in the recent Unity releases this was actually broken. What you end up seeing in your build UWP project in visual studio is the following error:

The command “”C:\ <Project>\Export\UWP\Unity\Tools\SerializationWeaver\SerializationWeaver.exe” “C:\ <Project>\Export\UWP\GeneratedProjects\UWP\Assembly-CSharp-firstpass\bin\x64\Debug\Unprocessed\Assembly-CSharp-firstpass.dll” “-pdb” “-verbose” “-unity-engine=C:\ <Project>\Export\UWP\Lonely Shadows\Unprocessed\UnityEngine.dll” “C:\ <Project>\Export\UWP\GeneratedProjects\UWP\Assembly-CSharp-firstpass\obj\x64\Debug\x64\Debug” “-lock=C:\ <Project>\Export\UWP\GeneratedProjects\UWP\Assembly-CSharp-firstpass\project.lock.json” “@C:\ <Project>\Export\UWP\GeneratedProjects\UWP\Assembly-CSharp-firstpass\SerializationWeaverArgs.txt” “-additionalAssemblyPath=C:\ <Project>\Export\UWP\Lonely Shadows\Unprocessed” “-unity-networking=C:\ <Project>\Export\UWP\Lonely Shadows\Unprocessed\UnityEngine.Networking.dll”” exited with code 1.
Assembly-CSharp-firstpass          C:\ <Project>\Export\UWP\GeneratedProjects\UWP\Assembly-CSharp-firstpass\Assembly-CSharp-firstpass.csproj   

If you dig further, you may also expose the underlying error code here:

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at UnityEditor.Scripting.Compilers.NuGetPackageResolver.Resolve()
   at Unity.NuGetAssemblyResolver..ctor(String projectLockFile)
   at usw.Weaver.ReaderParameters(String assemblyPath, ConversionOptions options)
   at usw.Weaver.Weave()
   at usw.Program.RunProgram(ConversionOptions options)
   at usw.Program.Main(String[] args)

This prevents you building / updating projects from Unity to the UWP Platform.

Once discovered, both Unity and Microsoft worked closely together to resolve the issues and updated their respective parts as quickly as possible.


Fixing the problem

The fix for this problem is fairly easy. However, it is a little time consuming (unless you have a mega fast download connection) as mostly it requires updating to the latest Unity and Visual Studio patch releases.

1: Install Unity 2017.1p5 or 2017.2p9

Image result for unity logo

The first step, is to simply update your installation of Unity:

  • If you are on Unity 2017, then this is 2017.1p5 (or newer)
  • If you are on Unity 2017.2, then this is 2017.2p9 (or newer)
  • For the 5.x cycle, just update to the latest patch (although I haven’t tested this)

This will update both Unity and your install of the Visual Studio Tools for Unity

2: Update VS 2017 to 15.3.3

Once Unity is up to date, you will need to update your installation of Visual Studio.  If you are still on VS 2015, then there is no action but you won’t be able to build UWP packages targeting the newer Creators update and won’t be able to build Mixed Reality platform.

I highly recommend updating to 2017, even the free Community edition of 2017 (which is free) if you are doing UWP development.  It’s just better.

To update Visual Studio 2017, simple close all open instances of Visual Studio and launch the Visual Studio Installer

image

Once it’s running (the first step may be to update the installer first), simply hit “Update” on your specific instance of Visual Studio (the installer will happily update ALL installed instances if you wish) and once it’s complete you will be on the latest version.

Open Visual Studio to verify, click “Help –> About Visual Studio” in the menu and you should be running 15.3.3 (or newer). If not, check your internet connection and try running the installer again.

image

3: (Optional) Set player settings for project to .NET & .NET4.6 (NOT IL2CPP, not tested but reports say it doesn’t play nice with Live)

Not strictly required but highly recommended for UWP projects, is to update the .NET Api Compatibility Level that is used in your built project.  This allows you to use more modern C# 6 functionality if you wish without causing errors when you build it in Unity.

To update this, open the Player Settings window in the editor using either “Edit –> Project Settings –> Player” in the editor menu, or using the “Player Settings” button on the “Build Settings” build window.  In the Other section on this configuration page you will find the following settings.

image

Not to be confused with the “Scripting Runtime Version”, which I’m told breaks UWP project builds (although I haven’t personally tested yet)

4: Build project targeting UWP SDK 14393 or higher

To build for Modern UWP, you need to be targeting a minimum API level of 14393 (Anniversary Edition), For Mixed Reality builds you will need a minimum API level of 15063 (Creators Update).  Either will work but you need to ensure you select the version that is right for your target.  The current advice with new builds is to always target the latest but that is completely up to you.

You will find the SDK selection on the “Build Settings” screen when you have the “Universal Windows Platform” target selected:

image

5: Open project in VS

Once you have built your project, open it in Visual Studio to continue.

6: UPDATE NETCore NuGet package to 5.4+ <- without this, it still doesn’t work

In testing I have found this is critical still for existing projects or when you build your first (ever) UWP project, you need to have the latest NETCore NuGet package downloaded and available else it will fail.  you don’t have to update the other NuGet packages if you don’t want to (UWP Packages come bundled with the Application Insights NuGets for Windows Store integration for example), just the NETCore package.

When writing this article, I tried to replicate the error (after fixing it) and couldn’t generate the error even with new projects.  This step may not actually be needed but I still Highly Recommend updating any and all NuGet packages in your built project.

 

If you are unsure as to what NuGet is, you can read all about it here. Basically, NuGet is a dependency manager for .NET solutions, allowing you to disconnect your project from the source of a dependency.  It can then be updated independently without affecting your project (unless the API changes).  You will find most modern .NET packages from Microsoft (like the .NET Framework) are now NuGet packages so they can more rapidly update the framework without having to build and distribute new MSI packages.

To check and update the versions of the NuGet packages, right-click on the “Solution” in the “Solution Explorer” within Visual Studio and select “Manage NuGet Packages for Solution…

image

Alternatively, you can also simply right-Click the “References” branch in your projects structure, also in the “Solution Explorer” in VS, this however will only show/update the NuGet’s installed in that single project and not the entire solution:

image

Once the NuGet manager is open you will see the installed NuGet packages, with a notification if any updates are available (provided you have an internet connection).

image

Simply select the NuGet package to update, NETCore in this case, select the version to update to on the right and click “Install”.   You will then be walked through a set of screens to accept the license for that package (if one exists) and then a final “get out of jail free” accept or reject screen.   Once complete, all the required references included in that package will be updated.

7: Build and Run for x64 only (x86 or Arm is a no go still)

With everything in place, all that is left is to build your project. By default, Unity still insists on selecting the ARM platform as the default (don’t know why but I guess it’s too small a thing to want to change), so you will need to update this to the x64 platform (don’t use x86 unless you really need it, most UWP systems all target x64 now).  After that, you can build.

If you are unsure about which Solution Configuration to select (read, Build Type), remember what they are there for:

  • Debug

    Used obviously for debugging, enables extra debugging information to be sent to an attached instance of Visual Studio (whether you run it from Visual Studio or just “attach” to it later).  Will cause a performance hit when running but this is needed so you can walk through the code if there are any issues.  It will also enable the debug window inside Unity to report errors to the screen should they occur.

  • Release

    Builds the project but without all the debugging stuff. just runs your project.  With Unity however, it’s keen to note you are still running your entire project with all the superfluous code that Unity has in a project.  DO NOT SHIP THIS!!!

     

  • Master

    This is a special Solution Configuration (just for Unity) that also runs code in Unity to strip mine unnecessary code / services and packages everything together neatly.  This makes your Unity project run as fast as it can.  <- SHIP/PUBLISH THIS!!!


All well and good

With everything in this article, you should have no further issues building your UWP projects and once you have gone through it at least once (I’ve found) you need not do it again (apart from updating NuGets, you should always do that)

Any issues, let me know or comment on this post. 

 

datesgrey-pdn

 


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By Sergio Ronchetti
      Continuing to work on “Eldest Souls” (first article here!), I’ve begun familiarising myself with the workflow between Fmod and Unity, and the integration system. I know much of this will be pretty obvious to most, but I thought I’d share my thoughts as a complete beginner learning the ropes of sound designing. 
      The library of sounds that Fmod provides has been very useful, at least as reference points. I’ve still kept to my ethos of producing the sounds myself as much as possible. Having said that, Fmod gives you 50 free sounds with your download, and I’ve used a wooden crate smash, a drawbridge and electricity sound you can hear in the foley video below.
       
       
      The thing i found most useful was witnessing changes i made in Fmod being realised instantly in Unity. If a volume needed changing, or the timing of one of my effects was off, i can literally switch to Fmod and then back to Unity and immediately see the result of my alterations. It also seems apparent that using middleware such as this (or i've heard Wwise is also equally intuitive) grants the developer, and myself included, a great deal more flexibility and opportunity to edit sounds without going all the way back to a DAW, and bouncing down again. Needless to say, my workflow is so much faster because of it.
      I've also loved the randomised feature of Fmod, whereby any sound can be made to sound slightly different each time it is heard. Taking a footstep recording i made for example, I was able to add further authenticity of uneven footsteps by randomising the pitch and volume of each playback. 
       

       
      I used this technique when creating footsteps for the first major boss in the game called "The Guardian". A big, over-encumbered husk of a monster. I also had fun rummaging through the garage for old tools and metal components for the “Guardian” (the first boss) footsteps. See below!
       
       
      I also created a sword attack for our player, trying to sound different from the generic “woosh” I see in so many video games. I used a very “sharp” and abrasive sound to differentiate him from any enemies.
       
       
      On another note, I recently upgraded my microphone to a Rode NTG2 shotgun, which has been phenomenal. I haven’t had to worry about noise interfering with the clarity of my objects, whereas before with the sm58 I had to be clever with my EQ and noise reduction plugins.
      Important to note again that this still a “cheap” mic in comparison to most other products on the market, and all in all my entire setup is still very simple and affordable which I’m quite proud of. I’ve seen many musicians spend heaps of money on gear they don’t necessarily need. I much prefer being resourceful with less equipment, than to have more than I can understand or remember how to use.
      It’s forced me to understand every aspect and capability of my tools, which I believe is a principal that can be applied to any discipline.
       
      I have more fun little sound effect videos on my Instagram for those interested, where I post regular updates. Thanks for reading! (if you’ve made it this far)
       
      www.sergioronchetti.com
      INSTAGRAM
      fallenflagstudio.com
    • By Sergio Ronchetti
      BASICS IN SOUND DESIGNING FOR VIDEO GAMES
       
      Recently I joined the talented team at Fallen Flag Studio as the composer for their latest release "Eldest Souls" which consequently lead me into a field I have always dreamt of trying - sound design!
      Having no prior experience, I began watching a few online tutorials (if you want to learn from anyone make it Akash Thakkar from "Hyper Light Drifter"... what a guy!) and basically just testing stuff out i found around the house. Luckily my dad has a garage FULL of random crap to use.
      Before i continue, it's important to note that i DO NOT have fancy equipment, meaning anyone can try this. (my equipment is an sm58, focusrite scarlett interface and Logic Pro X plugins... that's it!)
      I started basic with some footsteps, which weren't all too difficult. Then I moved on to projectiles and a spear attack one of the bosses has. Below are a couple super short videos on my resulting attempts.
       
       
      Amazing how great a banjo sounds for that typical "woosh" sound! And if you're wondering, the paper was added to give some texture to the jab.
      I could be finding a lot of these sounds in libraries online (like the built-in ones that come with Fmod and Unity) but I've chosen not to, in order to produce authenticity and hopefully a more unique gameplay experience for players when the final product is put together.
       
      P.S. if you'd like to try the game and hear my hard work we'll be at EGX and several other conventions later this year, soon to be announced! Thanks for reading!
      www.sergioronchetti.com
      fallenflagstudio.com
       
      To those interested, there's an Alpha trailer of the game in question below.
       
       
    • By Simon Crawford
      Hello, and thanks for taking the time to read my post.
       
      I am not here asking for someone to do my work for me. I am just looking for a mentor who would not mind answering a few of my questions, and give me a little guidance.
       
      I prefer chatting on discord, so if you are interested in helping me get started, please add me. My username is wize1 @8135
    • By KenzStudios
      Hello everyone,
      Who are you and what is this about?
      We are a team of two working on a Dungeon Based Turn-Based RPG that features a unique combat system and creative mechanics that bring the story to life.
      How far along are you?
      The engine the game will be using (which is built on top of Unity) is about 85% done so we felt this would be the best time to get others involved as we don't want to have you waiting too long to see something playable.
      What's your release plan?
      The plan is to release the first episode (three dungeons) for free on PC and Xbox (through the creators program) this holiday.
      This first episode is for us to test the fun aspect of the game mechanics, establish a name and generate a buzz. We're basically experimenting with releasing a game that we would love to play and would love for you join us.
      This game is part of a universe that we'd been planning for years and felt this would be the best intro to it and also the best way to polish our tools and knowledge.
      Depending on how the first episode is released will be received, and if you've joined the team and would love to take things up a notch, we can all sit down and discuss how to move to a full game.
      Who are you looking for?
      We are currently working with voice actors on the story, dialogue and voices for the full first episode. We are currently talking to a few music composers that are interested in collaborating on the game, but nothing has been finalized yet. If you're interested, please let us know. We are looking for artists for: Backgrounds: We are looking at something similar to Megaman X6 style of backgrounds.  Character Portraits:  The game is heavy on story, fully voice acted as well. For dialogues, we are looking at having the characters portraits pop up next to the dialogue with a few emotions. Think Persona style? Character Sprites: These are the characters as seen in the level  and combat as well as mini bosses, etc. Looking for going Megaman X6 style here. Level Assets and Battle Assets: Again Megaman X6 Style ... But you already knew that. Final words?
      We are super excited to finally see this come to life and while we're doing all of this currently unpaid, we feel it'd be a great side project and a fun game that will be trying something unique.
      And of course we'd love to meet all of you and make new friend along the way.
      If you're interested or have any questions or concerns, please feel free to reply to the topic or reach out to us.
      Looking forward to hearing from you
    • By Zooch
      Hi GameDev!
      Magical Game Studio is excited to present an opportunity to the CA community that we’re passionate about.  The game we’re working on is a throw-back to one of our favorites, Legend of Zelda: A Link to the Past, and we’re looking to create a similar 2D, top-down adventure game with more of a painterly art style and faster-paced gameplay. We are developing for Nintendo Switch and PC platforms (we’re Nintendo dev partners with Switch access).
      A bit about our own experience: we have signed contracts with three publishers across four previous games, ranging in funding from $400K to $5M.  As a team, we have shipped over 22 game titles in the past, and we’ve shipped both AAA and indie projects alike.  This specific project is in current negotiations with several notable publishers who want to see our First Playable demo in September.  This job posting refers to work that needs done for that First Playable milestone.
      Our studio is comprised of 17 members.  Several of us are currently employed full time in director or senior-level roles at other game companies, but this is our passion project that we’re looking to get funded so that we can quit our day jobs and establish our own studio.
      We’re currently looking for a character/creature animator who enjoys creating compelling hand-drawn, Disney quality animations.  We have roughly 240 frames to animate in total.  We have colorists that can take line art animations and bring them to final polish (if needed).  We do not use puppeting or symbol-based animation.  This is a typical contract with additional royalties added once the game ships.  The person who accepts this contract will be allowed to show their work on their portfolio.
      If you’re interested in hearing more, we have documented a full breakdown with more detail on the game itself (and us as a team) and we’d love to discuss it with you via Discord.  We also have a small game demo we can send you to test the game.  Simply email me at zach@riseofthemakers.com with your portfolio or examples of work and I’ll reply promptly.
      Art Style:
      MGS values two elements above all else: clarity and impact.  Players need to understand exactly what is happening within the game at all times and they must know that their input has significant impact on the game world.  Every button press needs to carry weight.  This means we look for people who can demonstrate core animation skills such as anticipation, body breaks and smearing.  Lastly, MGS prefers a painterly, visually expressive style that you’ll find in the link of images here:  https://imgur.com/a/WRyzC.
      For the lazy or paranoid, here are some samples from that image gallery:

      Concept art of our castle (not seen in First Playable but you get an idea of style).

      Zoomed out shot of our village inside Unity.  This is a fully functional level (minus the villagers).

      Concept art of our Bog Rusher

      In-game shot of our baker - one of the villagers.
      And some more “job” details:
      Primary responsibilities will include creating character and creature animations in the top-down perspective that will bring our game to life.  Specific tasks include animating the Bog Queen (the green monster shown above) as well as some simple NPC animations (such as our Baker, also shown above).
      Thanks for reading, and I hope to hear from you soon!
      Zach
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!