How to correctly handling nuget dependencies without pollution main project with unnecessary dependencies

196 Views Asked by At

Issue:

  • "Could not load file or assembly Razorlight...." during attempting to intaracting with CustomProject instance within the main solution

Prerequisites:

  • The main solution consumes custom project as nuget package
  • The custom project nuget package builded up as single dll (customProject.dll) with embedded references to dependent assemblies (etc. razorlight)
  • The custom project builded up as a single file due to includeReferencedProjects = true property from nugetpacksettings or nuspec configuration (not sure on 100 %)
  • Custom project nuget package has nuscpec configuration, to config output as single dll file
  • The custom project has dependency on 3-th party nuget packages with their dependencies (PackageA, PackageB .. etc.)
  • There no any other dlls in the main solution bin/Debug folder except customProject.dll after build

Intenstions: (Is it possible ?)

  • Manange the issue (Could not load file or assembly Razorlight). Thus have all nessacary dll in the MainSolution \bin folder in runtime (e.g razorlight.dll)
  • Not pollution the Main solution package.config & .csproj with a huge amount of unnessacary dependencies/ references from dependent packages (Razorlight, packageA, PackageB ... etc).
  • Wouldn't like to install Razorliaght or Itext7 nuget in the Main solution directly

enter image description here

0

There are 0 best solutions below