0

I have a solution that contains two projects: - projectA has a nuget reference to ServiceStack ormlite - projectB has a reference to projectA

When I build the solution the outdir for projectA contains all the assembly coming from nuget packages (4 assemblies), whereas the projectB only copies 2 of them. Obviously when I start it I get an FileNotFoundException. I have already tried with no success to add private=true flag

I have seen many references to this problem and it gets very confused now about what is going on here (it seems that msbuild does not handle reference the way I think is the only thing I know:().

Any idea what could be done to have a reliable process to build my solution ?

Artyom
  • 3,507
  • 2
  • 34
  • 67
Dave
  • 1,835
  • 4
  • 26
  • 44

1 Answers1

2

The build will only copy to projectB's output folder the assemblies that are actually used by projectA and result in references in projectA's output assembly, regardless of which assemblies projectA references.

You can open projectA's assembly with Reflector or ildasm and see that of those 4 assemblies only 2 are actually used and referenced.

If the assemblies need to be there at runtime for projectB, add a reference to the NuGet package to projectB as well, or make sure they are copied. This post shows a general-purpose solution, but I haven't tried it.

fsimonazzi
  • 2,975
  • 15
  • 13
  • Yes I have actually done that already. I try to avoid this route as my solution actually contains tens of projects and a equal number of unit tests projects(they do need as well to have the same treatment as what you propose). Thanks for the answer and the link, I just hope that MS sort this issue because in my case the problem occurs for many dependecies ( automapper, servicestack ormlite, servicestak interfaces, ...). – Dave Sep 25 '13 at 13:30
  • I image projectA uses those not copied assemblies as @Dave says he gets `FileNotFoundException`. – Artyom Feb 11 '16 at 07:44