I want to copy packages.config
of a project into newly created project and add reference with it in VS2015 SP3.
This post introduces Update-Package -Reinstall -ProjectName Your.Project.Name
but it does not work as I expected. Not all packages are added to project even though it has same build environment (.NET 4.5.2 Console App). Moreover, it overwrites packages.config
to only added packages after the reinstall process.
How to do it correctly?
+ Append Below is my actual packages.config
content.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Azure.WebJobs" version="1.1.2" targetFramework="net452" />
<package id="Microsoft.Azure.WebJobs.Core" version="1.1.2" targetFramework="net452" />
<package id="Microsoft.Azure.WebJobs.Extensions" version="1.0.1" targetFramework="net452" />
<package id="Microsoft.Data.Edm" version="5.8.1" targetFramework="net452" />
<package id="Microsoft.Data.OData" version="5.8.1" targetFramework="net452" />
<package id="Microsoft.Data.Services.Client" version="5.8.1" targetFramework="net452" />
<package id="Microsoft.EntityFrameworkCore" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.EntityFrameworkCore.Relational" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.EntityFrameworkCore.SqlServer" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Extensions.Caching.Abstractions" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Extensions.Caching.Memory" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Extensions.DependencyInjection" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Extensions.Logging" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Extensions.Options" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Extensions.Primitives" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net452" />
<package id="Microsoft.Web.WebJobs.Publish" version="1.0.12" targetFramework="net452" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" targetFramework="net452" />
<package id="ncrontab" version="2.0.0" targetFramework="net452" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="Remotion.Linq" version="2.1.1" targetFramework="net452" />
<package id="SimpleInjector" version="3.3.2" targetFramework="net452" />
<package id="SimpleInjector.Extensions.ExecutionContextScoping" version="3.3.2" targetFramework="net452" />
<package id="SlowCheetah" version="2.5.15" targetFramework="net452" />
<package id="System.Collections" version="4.3.0" targetFramework="net452" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net452" />
<package id="System.Collections.Immutable" version="1.3.1" targetFramework="net452" />
<package id="System.ComponentModel" version="4.3.0" targetFramework="net452" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net452" />
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net452" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net452" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net452" />
<package id="System.Globalization" version="4.3.0" targetFramework="net452" />
<package id="System.Interactive.Async" version="3.0.0" targetFramework="net452" />
<package id="System.IO" version="4.3.0" targetFramework="net452" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net452" />
<package id="System.Linq" version="4.3.0" targetFramework="net452" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net452" />
<package id="System.Linq.Queryable" version="4.3.0" targetFramework="net452" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net452" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net452" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net452" />
<package id="System.Reflection" version="4.3.0" targetFramework="net452" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net452" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net452" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net452" />
<package id="System.Runtime" version="4.3.0" targetFramework="net452" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.3.0" targetFramework="net452" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net452" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net452" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net452" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net452" />
<package id="System.Spatial" version="5.8.1" targetFramework="net452" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net452" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net452" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net452" />
<package id="System.Threading" version="4.3.0" targetFramework="net452" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net452" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net452" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net452" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net452" />
<package id="WindowsAzure.Storage" version="8.0.1" targetFramework="net452" />
</packages>
After you install a NuGet package, you can then make a reference to it in your code with the using <namespace> statement, where <namespace> is the name of package you're using.
packages. config: The targetframework attribute of a dependency specifies the variant of a package to install.
Today, a project's NuGet package information is stored in a project-level packages. config folder. The assemblies are stored in a separate packages folder, usually at the solution level.
Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to having a separate packages. config file. Use of PackageReference doesn't affect other aspects of NuGet; for example, settings in NuGet.
Please accept the Reload or Reload All after the reinstall process complete.
I got the same result after accept the Reload or Reload All to load the update project from disk in the process of reinstalling. Because your project is unload after accept the Reload or Reload All and the process of reinstalling is in progress. The packages could not be installed to the project during the project unload, NuGet will over write the package.config to only added packages before project unload.
The solution for this issue is that accept the Reload or Reload All after the reinstall process complete.
Update
There are different prompt for Conflicting File Modification Detected during the reinstalling. Please accept Reload or Overwrite after the reinstall process complete.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With