question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuget for Unity installs too many packages

See original GitHub issue

Description

Nuget for Unity installs too many packages. Aside from the package I want to install, it also installs packages from the System namespace (like System.IO, System.Linq, System.Collections, etc.), which should not be installed, because obviously those DLLs are already present.

Because of the installation of those additional DLLs, Unity complains about “Multiple assemblies with equivalent identity”.

The full content of the packages.config file after I installed only the one package mentioned below:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Castle.Core" version="4.4.0" />
  <package id="Microsoft.NETCore.Platforms" version="1.1.0" />
  <package id="Microsoft.NETCore.Targets" version="1.1.0" />
  <package id="Microsoft.Win32.Primitives" version="4.3.0" />
  <package id="Moq" version="4.15.1" />
  <package id="NETStandard.Library" version="1.6.1" />
  <package id="runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.native.System" version="4.3.0" />
  <package id="runtime.native.System.IO.Compression" version="4.3.0" />
  <package id="runtime.native.System.Net.Http" version="4.3.0" />
  <package id="runtime.native.System.Security.Cryptography.Apple" version="4.3.0" />
  <package id="runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple" version="4.3.0" />
  <package id="runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="System.AppContext" version="4.3.0" />
  <package id="System.Buffers" version="4.3.0" />
  <package id="System.Collections" version="4.3.0" />
  <package id="System.Collections.Concurrent" version="4.3.0" />
  <package id="System.Collections.NonGeneric" version="4.3.0" />
  <package id="System.Collections.Specialized" version="4.3.0" />
  <package id="System.ComponentModel" version="4.3.0" />
  <package id="System.ComponentModel.Primitives" version="4.3.0" />
  <package id="System.ComponentModel.TypeConverter" version="4.3.0" />
  <package id="System.Console" version="4.3.0" />
  <package id="System.Diagnostics.Debug" version="4.3.0" />
  <package id="System.Diagnostics.DiagnosticSource" version="4.3.0" />
  <package id="System.Diagnostics.Tools" version="4.3.0" />
  <package id="System.Diagnostics.TraceSource" version="4.3.0" />
  <package id="System.Diagnostics.Tracing" version="4.3.0" />
  <package id="System.Dynamic.Runtime" version="4.3.0" />
  <package id="System.Globalization" version="4.3.0" />
  <package id="System.Globalization.Calendars" version="4.3.0" />
  <package id="System.Globalization.Extensions" version="4.3.0" />
  <package id="System.IO" version="4.3.0" />
  <package id="System.IO.Compression" version="4.3.0" />
  <package id="System.IO.Compression.ZipFile" version="4.3.0" />
  <package id="System.IO.FileSystem" version="4.3.0" />
  <package id="System.IO.FileSystem.Primitives" version="4.3.0" />
  <package id="System.Linq" version="4.3.0" />
  <package id="System.Linq.Expressions" version="4.3.0" />
  <package id="System.Net.Http" version="4.3.0" />
  <package id="System.Net.Primitives" version="4.3.0" />
  <package id="System.Net.Sockets" version="4.3.0" />
  <package id="System.ObjectModel" version="4.3.0" />
  <package id="System.Reflection" version="4.3.0" />
  <package id="System.Reflection.Emit" version="4.3.0" />
  <package id="System.Reflection.Emit.ILGeneration" version="4.3.0" />
  <package id="System.Reflection.Emit.Lightweight" version="4.3.0" />
  <package id="System.Reflection.Extensions" version="4.3.0" />
  <package id="System.Reflection.Primitives" version="4.3.0" />
  <package id="System.Reflection.TypeExtensions" version="4.3.0" />
  <package id="System.Resources.ResourceManager" version="4.3.0" />
  <package id="System.Runtime" version="4.3.0" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" />
  <package id="System.Runtime.Extensions" version="4.3.0" />
  <package id="System.Runtime.Handles" version="4.3.0" />
  <package id="System.Runtime.InteropServices" version="4.3.0" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" />
  <package id="System.Runtime.Numerics" version="4.3.0" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.0" />
  <package id="System.Security.Cryptography.Cng" version="4.3.0" />
  <package id="System.Security.Cryptography.Csp" version="4.3.0" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" />
  <package id="System.Security.Cryptography.OpenSsl" version="4.3.0" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" />
  <package id="System.Text.Encoding" version="4.3.0" />
  <package id="System.Text.Encoding.Extensions" version="4.3.0" />
  <package id="System.Text.RegularExpressions" version="4.3.0" />
  <package id="System.Threading" version="4.3.0" />
  <package id="System.Threading.Tasks" version="4.3.0" />
  <package id="System.Threading.Tasks.Extensions" version="4.5.1" />
  <package id="System.Threading.Timer" version="4.3.0" />
  <package id="System.Xml.ReaderWriter" version="4.3.0" />
  <package id="System.Xml.XDocument" version="4.3.0" />
  <package id="System.Xml.XmlDocument" version="4.3.0" />
</packages>
  • NuGet Package: Moq, 4.15.1
  • NuGetForUnity Version: 2.0.0
  • Unity Version: 2020.1.6f1
  • Operating System: Win 10, 64 bit

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
KonHcommented, Dec 17, 2020

Yeah, I will try to make PR for that in next few days.

1reaction
jwittnercommented, Dec 16, 2020

At this line you can see where we’re deleting subfolders of the Nuget “lib” folder based on the “best” target framework for the given settings. Around this point in the code I think we should:

  1. Use this same “best” target framework and the idea above to scour the Unity install directory for dlls that Unity already provides for that “best” target framework.
  2. Look in the selected lib directories that we’re keeping and delete any dlls that Unity is already providing.

Does that make sense?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NuGet packages in Unity
The nuget. config file can be configured to download the packages into the Plugins folder inside the Assets folder. The Problem is that...
Read more >
GitHub - GlitchEnzo/NuGetForUnity: A NuGet Package ...
How do I install NuGetForUnity? ... Unity 2019.3 or newer ... Click + button on the upper-left of a window, and select "Add...
Read more >
Unity3D removes successfully installed NuGet package ...
Ok, I am desperate: I am trying to access a MariaDB installation from C# under Unity3D using Rider2020. After installing the MySqlConnector ...
Read more >
Installing NuGet packages in Unity 2021
Installing NuGet packages in Unity 2021 · Step 1: Install Nuget Package · Step 2: Make the DLL available to Unity · Step...
Read more >
Unity and NuGet + JSON.net
To install NuGet packages into Unity and have them survive Unity's regeneration of the solution, you must create a custom NuGet configuration ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found