NuGet package install uses specific assembly versi

2020-06-28 05:27发布

问题:

We are using NuGet in our projects, we are facing issues with the csproj references of the NuGet packages.

Scenario 1

When we are installing few packages to the solution on Dev system with below details,

  • Windows 7, x64 bit
  • Visual Studio 2012
  • NuGet 2.8
  • PTC Integrity for version control

It adds the specific version to the csproj files. as given below, (csproj snippet),

<Reference Include="ABCD.XYZ, Version=1.0.6045.25123, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\ABCD.XYZ.2.0.0.0\lib\net45\ABCD.XYZ.dll</HintPath>
<Private>True</Private>
</Reference>

Scenario 2

When adding the same package on build server with below details

  • Windows Server 2008 R2
  • Visual Studio 2012
  • NuGet 2.8
  • PTC Integrity for version control

It adds below details,

<Reference Include="ABCD.XYZ">
  <HintPath>..\packages\ABCD.XYZ.2.0.0.0\lib\net45\ABCD.XYZ.dll</HintPath>
  <Private>True</Private>
</Reference>

How is the specific version is added ? I see this post is mentioning that it adds below tag to the csproj for that user, but that's not the case for us.

<SpecificVersion>False</SpecificVersion>
  • My scenario here is that, our build increments the ABCD.XYZ Assembly Version with each build. Therefore the project which has above reference is failing as it's not able to find the version above (NuGet adds strong name in the reference)

  • I have tried various build configurations like Debug, Release, x64, Any CPU etc.

  • Updating csproj manually, isn't that flexible option

So, here are my few questions,

  • How is this specific version or strong name is added to the csproj ?
  • Is there any option to add/ignore specific version ?
  • What is required to add the reference as highlighted in Scenario 2 ?

Please let us know if additional data is required.