I am using VS2010 and I tried to add a few assemblies from local hard disk to my C# project through file reference. Peeking into the csproj
file, I found sometimes the file reference appears as
<Reference Include="name">
However sometimes it appears as
<Reference Include="name, Version=xxx, Culture=neutral,
processorArchitecture=MSIL">
What could cause the difference?
Inspired by k3b's answer, I did another test. I created a new class library project.
Add a file reference. The initial value of Specific Version in Properties pane is False. The
csproj
file look like<Reference Include="Name"> <HintPath>...</HintPath> </Reference>
Change Specific Version in Properties pane to True. VS adds version in the
Include
attribute.<Reference Include="Name, Version=..."> <HintPath>...</HintPath> </Reference>
Change Specific Version in Properties pane to False again. VS adds a child element
SpecificVersion
.<Reference Include="Name, Version=..."> <HintPath>...</HintPath> <SpecificVersion>False</SpecificVersion> </Reference>
So it seems that the rule is:
- When Version is present in Include attribute and there is no
SpecificVersion
child element, the file assembly is configured to be Specific Version - The
SpecificVersion
child element is only appended with value False.
One thing I still do not understand:
- For my new test project, if I remove the file reference and add it back again, it goes back to format in point 1, which is the default.
- For my existing project, if I remove the file reference and add it back again, I get back format in point 3. Although it also means that Specific Version is not used, I am wondering why it does not go back to format in point 1.
SpecificVersion
is a child of the elementReference
. Is has no impact on<Reference Version="..."/>
other that the attributs is ignored. – Chloechloette