0

I tried to add the package by simply appending with appropriate xml tag in the package.config and I tried to build the project but its not adding the reference in the project.

The newly added package is

  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />

My Existing package.config is

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Castle.Core" version="4.0.0" targetFramework="net461" />
  <package id="Moq" version="4.7.25" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
  <package id="XtraLib.Common" version="1.0.1" targetFramework="net452" />
</packages>

My update version of the package.config is

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Castle.Core" version="4.0.0" targetFramework="net461" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
  <package id="Moq" version="4.7.25" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
  <package id="XtraLib.Common" version="1.0.1" targetFramework="net452" />
</packages>

While on building the project is not adding the reference. Kindly assist me how to do this. Because I get information and I will add it here instead of manual installation.

Note: I'm using Visual Studio 2015 Framework 4.6.1

  • Any update for this issue? Could you get any useful info from the answer? If not, let me know the latest info about this question for free. – Leo Liu Jun 26 '17 at 08:41
  • @Leo-MSFT - No, its not updating the package. –  Jun 26 '17 at 09:57
  • I have updated my answer with a sample for this question, you can check if it help you. If not, could you share us the detail result after using below method? – Leo Liu Jun 27 '17 at 01:59

1 Answers1

0

While on building the project is not adding the reference. Kindly assist me how to do this. Because I get information and I will add it here instead of manual installation.

That because NuGet Restore only restores files in the packages directory (\packages folder ), but does not restore files inside your project or otherwise modify your project.

You should use the NuGet command line in the Package Manager Console after you first build:

Update-Package -reinstall

to force reinstall the package references into project.

You can refer to the similar issue on stackoverflow for detail info.

Note: You should make sure the checkboxes of "Allow NuGet to download missing packages" and "Automatically check for missing packages during build in Visual Studio" are checked(Tools->Option->NuGet Package Manager->General).

enter image description here

Update: I have created a sample for this question, you can refer to below for more detail:

enter image description here

Note: After the command Update-Package -reinstall, the targetFramework of all package will change to net461(Because you are using Visual Studio 2015 Framework 4.6.1).

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • @Mastero , I have update my answer more detail, you can check if it help you. If not, please let me know for free, I will keep follow. – Leo Liu Jun 23 '17 at 06:14