|
1 | 1 | # Runtime Identifier Dependencies |
2 | 2 |
|
3 | | -The NuGet package for the C# bindings includes binary distributions for major platform runtimes targeted by [liblsl](https://github.com/sccn/liblsl). To successfully build the package, these binaries need to be downloaded from [liblsl releases](https://github.com/sccn/liblsl/releases) and included in this folder following the RID naming conventions outlined in the [RID Catalog](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog). |
| 3 | +The NuGet package for the C# bindings includes binary distributions for major platform runtimes targeted by [liblsl](https://github.com/sccn/liblsl). To successfully build the package, these binaries need to be downloaded from [liblsl releases](https://github.com/sccn/liblsl/releases) and included in this folder following the RID naming conventions outlined in the [RID Catalog](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog). |
| 4 | + |
| 5 | +The following [architecture-specific folders](https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks#architecture-specific-folders) are recommended: |
| 6 | + |
| 7 | +``` |
| 8 | +\runtimes |
| 9 | + \linux-x64 |
| 10 | + \native |
| 11 | + liblsl.so |
| 12 | + liblsl.so.1.14.0 |
| 13 | + \osx-x64 |
| 14 | + \native |
| 15 | + liblsl.dylib |
| 16 | + liblsl.1.14.0.dylib |
| 17 | + \win-x64 |
| 18 | + \native |
| 19 | + lsl.dll |
| 20 | + \win-x86 |
| 21 | + \native |
| 22 | + lsl.dll |
| 23 | +``` |
| 24 | + |
| 25 | +## Project files for dependent projects |
| 26 | + |
| 27 | +From Visual Studio 2019, both .NET Core (`dotnet`) and .NET Framework compilers will use the `RuntimeIdentifier` element of the new SDK csproj format to control which native dependencies to deploy to the final output folder. |
| 28 | + |
| 29 | +### .NET Core |
| 30 | +In .NET Core, the default is to generate cross-platform deployments, which means that all the runtimes will be deployed to the final output folder. By inserting a specific `RuntimeIdentifier` a build targeting only the specified architecture is generated. |
| 31 | + |
| 32 | +```xml |
| 33 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 34 | + |
| 35 | + <PropertyGroup> |
| 36 | + <OutputType>Exe</OutputType> |
| 37 | + <TargetFramework>net5.0</TargetFramework> |
| 38 | + <!--<RuntimeIdentifier>linux-x64</RuntimeIdentifier>--> |
| 39 | + </PropertyGroup> |
| 40 | + |
| 41 | + <ItemGroup> |
| 42 | + <PackageReference Include="lsl_csharp" Version="2.0.0" /> |
| 43 | + </ItemGroup> |
| 44 | + |
| 45 | +</Project> |
| 46 | +``` |
| 47 | + |
| 48 | +### .NET Framework |
| 49 | +In legacy .NET framework projects, `RuntimeIdentifier` defaults to `win7-x86` which has the generic fallback to `win-x86`. Therefore, the above folder structure will automatically copy `lsl.dll` into the output folder of .NET Framework projects. |
| 50 | + |
| 51 | +```xml |
| 52 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 53 | + |
| 54 | + <PropertyGroup> |
| 55 | + <OutputType>Exe</OutputType> |
| 56 | + <TargetFramework>net472</TargetFramework> |
| 57 | + <!--<RuntimeIdentifier>win-x64</RuntimeIdentifier>--> |
| 58 | + </PropertyGroup> |
| 59 | + |
| 60 | + <ItemGroup> |
| 61 | + <PackageReference Include="lsl_csharp" Version="2.0.0" /> |
| 62 | + </ItemGroup> |
| 63 | + |
| 64 | +</Project> |
| 65 | +``` |
0 commit comments