简体   繁体   English

将nuget包转移到新的解决方案

[英]Transfer nuget Packages to new solution

I've a visual studio 2015 project in a solution. 我在解决方案中有一个视觉工作室2015项目。 I need to create a very similar project and didn't want to manually add all packages again. 我需要创建一个非常相似的项目,并且不想再次手动添加所有包。

So I copied the packages json and ran "Restore nuget packages" But this command only downloaods the libs and doesn't add assembly references to the project file. 所以我复制了包json并运行了“Restore nuget packages”但是这个命令只下载了libs并且没有向项目文件添加程序集引用。

Is there a command line to enforce this ? 是否有命令行来强制执行此操作?

I Know I could also copy and adjust the content of the csproj but I'm very courious if there is a built in way. 我知道我也可以复制和调整csproj的内容,但是如果有内置方式我会非常好。

The packages.config looks like this: packages.config看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="BouncyCastle" version="1.7.0" targetFramework="net461" />
  <package id="Common.Logging" version="3.3.1" targetFramework="net461" />

[...] [...]

With the packages.config copied into your project you can run the following command from the Package Manager Console to reinstall the NuGet packages. 将packages.config复制到项目中后,您可以从程序包管理器控制台运行以下命令以重新安装NuGet程序包。

Update-Package -reinstall

You can also restrict this to one project. 您也可以将此限制为一个项目。

Update-Package -reinstall -ProjectName MyProject

The -reinstall parameter will get NuGet to add back the assembly references to the project. -reinstall参数将使NuGet将程序集引用添加回项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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