I'm working with latest release of .NET Core 1.0 ( dotnet-dev-1.0.0-preview2-003121
) under Ubuntu 16.04 LTS.
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
.
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?
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.
You need to tell dotnet
where it can find the NuGet package. You can do that using a NuGet.Config file, either a local one or a global one.
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:
<?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. On Linux, its location is ~/.nuget/NuGet/NuGet.Config
.
You are almost here. After creating own nuget package you should distribute it using your own 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):
<?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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.