Search code examples
c#visual-studiomsbuildnugetmsbuild-projectreference

What gets precedence during build? nuget reference or project reference


I have a .net solution that has two class library projects (Say A and B) that I am also publishing to a nuget server.

If I were to add A as a project reference as well as a nuget reference on B, what version of the A.dll should I expect in the bin folder of B when I compile?

Is there a rule which determines what reference gets precedence? What happens if the two dlls have different versions?

P.S - I am building from VS


Solution

  • This is moot question. Turns out you cannot have a referenced twice (as a project and nuget reference). Visual studio blocks you if you try to add a project reference if it already exists as a nuget reference and if you add a nuget reference when you already have a project reference of the same name then it gets overriden (your project reference goes away and is replaced by nuget reference)