Nuget: What is the purpose of the <package requireReinstallation /> attribute in packages.config?

C#Nuget

C# Problem Overview


I upgraded my C# project (which already had some nuget packages) from 4.0 to 4.5.2. I saw that some <package /> elements now contain an additional attribute requireReinstallation="true".

  • What is the purpose of this?

  • Why is that some packages have while others don't.

Before

<package id="NLog" version="3.1.0.0" targetFramework="net40" />

After

<package id="NLog" version="3.1.0.0" targetFramework="net40" requireReinstallation="true" />

C# Solutions


Solution 1 - C#

From the release notes

>If we detect that any of your packages were affected by the retargeting or upgrade, we’ll produce immediate build errors to let you know. In addition to the immediate build error, we also persist a requireReinstallation="true" flag in your packages.config file for all packages that were affected by the retargeting, and each subsequent build in Visual Studio will raise a build warnings for those packages.

Essentially, NuGeT is automatically flagging packages which conflict with your project target or version

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNikhil AgrawalView Question on Stackoverflow
Solution 1 - C#RobView Answer on Stackoverflow