From 282cf5826432dca9b7bd4fecfd61d4bafaaf1537 Mon Sep 17 00:00:00 2001 From: cartermp Date: Wed, 12 Oct 2016 17:23:05 -0700 Subject: [PATCH 1/3] Update native dependencies section to specify RID correctly --- docs/core/tutorials/libraries.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/core/tutorials/libraries.md b/docs/core/tutorials/libraries.md index 81ff3d914b47d..79a30f3a822dc 100644 --- a/docs/core/tutorials/libraries.md +++ b/docs/core/tutorials/libraries.md @@ -342,9 +342,9 @@ You may wish to write a library which depends on a native `.dll` file. If you'r For the first option, you'll need to include the following in your `project.json` file: 1. Setting `allowUnsafe` to `true` in a `buildOptions` section. -2. Specifying the path to the native `.dll`(s) with a [Runtime Identifier (RID)](../rid-catalog.md) under `files` in the `packOptions` section. +2. Specifying the path to the native `.dll`(s) with a [Runtime Identifier (RID)](../rid-catalog.md) under `runtimes/{RID}/native`, under `mappings`, under `files` in the `packOptions` section. -If you're distributing your library as a package, it's recommended that you place the `.dll` file at the root level of your project. Here's an example `project.json` for a native `.dll` file that runs on Windows x64: +If you're distributing your library as a package, it's recommended that you place the `.dll` file at the root level of your project. Here's an example `project.json` for a native `.dll` file in the root directory of the project which runs on Windows 10 x64: ```json { @@ -353,8 +353,15 @@ If you're distributing your library as a package, it's recommended that you plac }, "packOptions":{ "files":{ - "runtimes/win7-x64/native/":"native-lib.dll" + "mappings":{ + "runtimes/win10-x64/native":{ + "includeFiles":[ "native-lib.dll"] + } + } } + }, + "runtimes":{ + "win10-x64":{} } } ``` From 862446b42ce068509cfbdccdcc18bf81840c6ba5 Mon Sep 17 00:00:00 2001 From: cartermp Date: Wed, 12 Oct 2016 19:35:36 -0700 Subject: [PATCH 2/3] Address feedback --- docs/core/tutorials/libraries.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/core/tutorials/libraries.md b/docs/core/tutorials/libraries.md index 79a30f3a822dc..a4aa7870754bb 100644 --- a/docs/core/tutorials/libraries.md +++ b/docs/core/tutorials/libraries.md @@ -342,15 +342,19 @@ You may wish to write a library which depends on a native `.dll` file. If you'r For the first option, you'll need to include the following in your `project.json` file: 1. Setting `allowUnsafe` to `true` in a `buildOptions` section. -2. Specifying the path to the native `.dll`(s) with a [Runtime Identifier (RID)](../rid-catalog.md) under `runtimes/{RID}/native`, under `mappings`, under `files` in the `packOptions` section. +2. Specifying a [Runtime Identifier (RID)](../rid-catalog.md) in a `runtimes` section. +3. Specifying the path to the native `.dll`(s) that you are referencing. -If you're distributing your library as a package, it's recommended that you place the `.dll` file at the root level of your project. Here's an example `project.json` for a native `.dll` file in the root directory of the project which runs on Windows 10 x64: +Here's an example `project.json` for a native `.dll` file in the root directory of the project which runs on Windows: ```json { "buildOptions":{ "allowUnsafe":true }, + "runtimes":{ + "win10-x64":{} + }, "packOptions":{ "files":{ "mappings":{ @@ -359,13 +363,12 @@ If you're distributing your library as a package, it's recommended that you plac } } } - }, - "runtimes":{ - "win10-x64":{} } } ``` +If you're distributing your library as a package, it's recommended that you place the `.dll` file at the root level of your project. + For the second option, you'll need to build a NuGet package out of your `.dll` file(s), host on a NuGet or MyGet feed, and depend on it directly. You'll still need to set `allowUnsafe` to `true` in the `buildOptions` section of your `project.json`. Here's an example (assuming `MyNativeLib` is a Nuget package at version `1.2.0`): ```json From b97258e6599d899f1cf8a8525f5c15557c5d8284 Mon Sep 17 00:00:00 2001 From: cartermp Date: Mon, 17 Oct 2016 10:39:00 -0700 Subject: [PATCH 3/3] Address @mairaw feedback I missed --- docs/core/tutorials/libraries.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tutorials/libraries.md b/docs/core/tutorials/libraries.md index a4aa7870754bb..504f43743e6a5 100644 --- a/docs/core/tutorials/libraries.md +++ b/docs/core/tutorials/libraries.md @@ -343,7 +343,7 @@ For the first option, you'll need to include the following in your `project.json 1. Setting `allowUnsafe` to `true` in a `buildOptions` section. 2. Specifying a [Runtime Identifier (RID)](../rid-catalog.md) in a `runtimes` section. -3. Specifying the path to the native `.dll`(s) that you are referencing. +3. Specifying the path to the native `.dll` file(s) that you are referencing. Here's an example `project.json` for a native `.dll` file in the root directory of the project which runs on Windows: