Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

nuget

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" /> 
like image 549
Nikhil Agrawal Avatar asked Nov 04 '16 12:11

Nikhil Agrawal


People also ask

What about NuGet packages and packages config?

The packages. config file is used in some project types to maintain the list of packages referenced by the project. This allows NuGet to easily restore the project's dependencies when the project is to be transported to a different machine, such as a build server, without all those packages.

What is a NuGet package and what is it used for?

NuGet is a package manager that delivers compiled source code (DLLs) and other files (scripts and images) related to code. A NuGet package takes the form of a zip file with the extension . nupkg. This makes adding, updating, and removing libraries easy in Visual Studio applications.

Where is NuGet packages config?

If you right click the project in question you can select "Manage nuGet Packages" from the menu. After you do that you can click "installed packages" on the left hand side to see the packages that you currently have installed. These are what you are seeing in your "packages. config" file.

What is package config Targetframework?

packages. config: The targetframework attribute of a dependency specifies the variant of a package to install.


1 Answers

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

like image 76
Rob Avatar answered Sep 18 '22 13:09

Rob