Is it possible to not load some NuGet dependencies?

84 Views Asked by At

I have merged some .net standard projects dlls into one big dll MergedAssemblies.dll. Now I have a xamarin app which uses MergedAssemblies.dll and also has a reference to Nuget1.

Unfortunately Nuget1 has dependencies on its own, and some of those dependencies where already merged into the MergedAssemblies.dll. Now when the xamarin apps builds it cannot solve some types as they exist in 2 places.

Is it possible to not load some dependencies of the Nuget1 as they have already been loaded into MergedAssemblies.dll?

Is there another approach of solving this?

I cannot merge the Nuget1 directly into MergedAssemblies.dll because it is not compatible.

1

There are 1 best solutions below

0
Nick Kovalsky On

You can unload project then right-click and edit .cproj, then insert "an exclusive reference", ex:

<PackageReference Include="System.Reflection.Emit">
  <Version>4.3.0</Version>
  <ExcludeAssets>all</ExcludeAssets>
</PackageReference>

that would exclude reference to System.Reflection.Emit that could come from other referenced nugets.