简体   繁体   中英

Why do some assembly references have a version and others not when added through NuGet

I'm adding all packages through NuGet, so I'm not manually tweaking the Specific Version property in Visual Studio. However depending on which package (or even which version) I add, I end up with different ways of how the reference is added. As you can see below:

  • A reference to Autofac is added without a version.
  • A reference to AutoMapper is added, but the assembly version is added as well. Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL"

Even stranger is the fact that the stable NuGet package of AutoMapper doesn't add the version either (make sure you save the csproj file between changing packages). What's the reason that packages added through the same method (NuGet install package) results in different configurations?

<Reference Include="Autofac">
  <HintPath>..\packages\Autofac.3.1.1\lib\portable-win+net40+sl50+wp8\Autofac.dll</HintPath>
</Reference>
<Reference Include="AutoMapper, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\packages\AutoMapper.3.0.0-ci1043\lib\windows8\AutoMapper.dll</HintPath>
</Reference>

I've found that if I add the dependencies with nuget.exe, I get the first way and if I use Package Manager Console in Visual Studio, it adds them the second way. I don't remember which way the Manage NuGet Packages in Visual Studio does it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM