Search code examples
visual-studiovisual-studio-2008projects-and-solutions

Project reference in one .sln, and assembly reference in another


Scenario

This is the distillation of the problem we are having...

  1. We have two solution files. Both have a project reference to the same project, ProjA
  2. ProjA has a reference to ProjX

Scenario

Problem

We would like the ProjX reference to be a project reference in SolutionOne, but an assembly reference in SolutionTwo

How can this be done, since ProjA.csproj is the same file referenced by both solutions?


Solution

  • I've never done this before but this sounds like a conditional build. You'd need to define new solution configurations - instead of Debug/Release, you'd call them ProjRef and AsmRef. SolutionOne would build using ProjRef and SolutionTwo would build using AsmRef. Then, you'd modify your vbproj/csproj and tag the reference with the Condition.

    Take a look at this article:

    http://weblogs.asp.net/lkempe/archive/2009/12/02/projectreference-with-condition-in-your-msbuild-project-files.aspx