How to set "Specific Version" property for project references in Visual Studio

kay.herzam picture kay.herzam · May 27, 2009 · Viewed 18.6k times · Source

I have got a Visual Studio Solution containing several projects and have set up the references between the projects as project references.

When a reference to an assembly is added, the references' properties contain a setting for

Specific Version = True|False

This property is missing for project references. How can it be set? I'd like my solution to load any available assembly (no matter what version) in the bin folder.

I've had a problem when a workflow instance (Workflow Foundation) was deserialized and the dependencies were updated meanwhile.

Answer

jerryjvl picture jerryjvl · May 27, 2009

I think the problem is that what you are asking is not possible directly with a project reference, I think that always implicitly turns into an 'explicit version', because of the nature of the link.

The way you could do this (calling the currently referenced project A, and the referencing project B):

  • Have the project you want to reference in your solution, just like you do now with the project reference
  • Explicitly set the dependency chain so the 'referenced' project is built first
  • Build the referenced project A once first manually
  • Create an assembly reference in project B to the results from the build in project A
  • Set the assembly reference to 'Specific Version = false'

The build order (dependency) will guarantee that A is always built before B, and B will reference it from the binary output directory of A.

(altho, it's a little brittle and I would not recommend it since it's easy to get wrong results if the settings are not all right, or the sun aligns with the stars wrong, or some such)