[英]How to specify dependency of netcoreapp1.0 on local nuget package?
I'm working with latest release of .NET Core 1.0 ( dotnet-dev-1.0.0-preview2-003121
) under Ubuntu 16.04 LTS. 我正在使用Ubuntu 16.04 LTS下的最新版本的.NET Core 1.0(
dotnet-dev-1.0.0-preview2-003121
)。
I have a local shared library written under Mono ported to .NET Core (NetStandard 1.6) and I use dotnet pack
to produce a .nupkg
and .symbols.nupkg
. 我有一个在Mono下编写的本地共享库,已移植到.NET Core(NetStandard 1.6),并且使用
dotnet pack
生成了.nupkg
和.symbols.nupkg
。
Now I create a netcoreapp1.0
using dotnet new
, how can I write dependencies
in project.json
to add the local dll or nuget package to the references, just like adding the dll
to reference as in VS/Mono previously? 现在,我使用
dotnet new
创建一个netcoreapp1.0
,如何在project.json
编写dependencies
以将本地dll或nuget包添加到引用中,就像以前在VS / Mono中将dll
添加到引用中一样?
I read .net core RC2 using own local Nuget Package: The folder netstandard1.5 contains an invalid version but it seems not to solve my problem. 我使用自己的本地Nuget包阅读.net core RC2:文件夹netstandard1.5包含无效版本,但似乎无法解决我的问题。
You need to tell dotnet
where it can find the NuGet package. 您需要告诉
dotnet
在哪里可以找到NuGet软件包。 You can do that using a NuGet.Config file, either a local one or a global one. 您可以使用NuGet.Config文件(本地文件或全局文件)来执行此操作。
To set up a directory as a package source locally, create a file named NuGet.Config file in the project directory, or one of the directories up the directory tree from it, containing something like: 要将目录设置为本地包源,请在项目目录中创建一个名为NuGet.Config的文件,或从目录树中向上的目录树之一,其中包含以下内容:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="my-local-source" value="path/to/your/local/source" />
</packageSources>
</configuration>
To set up a package source globally, change the global NuGet.Config file instead. 若要全局设置程序包源,请改为更改全局NuGet.Config文件。 On Linux, its location is
~/.nuget/NuGet/NuGet.Config
. 在Linux上,它的位置是
~/.nuget/NuGet/NuGet.Config
。
You are almost here. 你快到了 After creating own nuget package you should distribute it using your own Local Nuget Feed .
创建自己的nuget软件包后,您应该使用自己的Local Nuget Feed分发它。 To do this open your
NuGet.config
file and add your local feed inserting new item into packageSources (path to your local folder with nuget packages): 为此,请打开您的
NuGet.config
文件,然后添加将新项插入packageSources的本地供稿(包含nuget包的本地文件夹的路径):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
...
<add key="LocalFeed" value="<path to your local folder>" />
</packageSources>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.