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

19,118

Solution 1

I have found the solution to my problem. It's described pretty detailed here. The problem is not a matter of wrong project references, but more a de/serializing of workflow instances question.

Thanks to everybody who tried to help.

Solution 2

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)

Solution 3

I might be misunderstanding your question, but when you add a project reference, the project's assembly is always loaded into any project that references it when the project is built. Therefore, you'll always have the latest available assembly in the bin folder for that project. VS treats projects differently than other assemblies in that regard.

Solution 4

You can add references to project output dlls instead of projects. Then you will be able to set Specific Version setting.

Share:
19,118
Jolley71717
Author by

Jolley71717

Updated on June 04, 2022

Comments

  • Jolley71717
    Jolley71717 almost 2 years

    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.

  • Jolley71717
    Jolley71717 almost 15 years
    I have updated the question. I'd like to load any available version in the bin folder. I've had a problem when a workflow instance (Workflow Foundation) was deserialized and the dependencies were updated meanwhile.
  • Jolley71717
    Jolley71717 almost 15 years
    Thanks for your answer. But how do you deal with debug and release assemblies? They are in different folders.
  • Juozas Kontvainis
    Juozas Kontvainis almost 15 years
    You can use variables in <HintPath> by editing .csproj file, e.g. <HintPath>$(OutDir)\Referenced.dll</HintPath> or <HintPath>..\Referenced\bin\$(Configuration)\Referenced.dll<‌​/HintPath>
  • Jonathan van de Veen
    Jonathan van de Veen over 9 years
    Unfortunately the link is broken. Is it possible to fix it?
  • Jolley71717
    Jolley71717 over 9 years
    I have updated the link, but the first part of the post is not available anymore. Please be aware that the problem was with WF 3.5. Todays WF 4.5 offers much more out of the box in terms of WF versioning.
  • Alain
    Alain over 8 years
    You can support matching the referenced project's output folder for different build configurations (Release/Debug) by opening up the "ProjectB.csproj" file in a text editor and changing the <HintPath> for the reference to (for example) <HintPath>..\ProjectA\bin\$(Configuration)\ProjectA.dll</Hin‌​tPath>