In dotnet/runtime we're currently enabling a feature for applications to carry their own copy of ICU for globalization purposes instead of using system-wide installed ICU.
In order to make this feature work, we're using NativeLibrary.TryLoad API which uses some probing using NATIVE_DLL_SEARCH_DIRECTORIES property passed by the host to the runtime. However, this property is populated based of the deps.json file, so if we don't have any native assets coming from NuGet packages or we want to use a different folder for our custom built native assets, we wont be able to load from there as NATIVE_DLL_SEARCH_DIRECTORIES will not include this directory. This is of course blocking for framework dependent apps as for self contained apps NATIVE_DLL_SEARCH_DIRECTORIES includes the app directory always.
Currently the only way to have native assets included in deps.json file is via NuGet resolved assets, however, I did manage to do this by adding:
<ItemGroup>
<IcuAssemblies Include="icu\*.so*" />
<RuntimeTargetsCopyLocalItems Include="@(IcuAssemblies)" AssetType="native" CopyLocal="true" DestinationSubDirectory="runtimes/linux-x64/native/" DestinationSubPath="%(FileName)%(Extension)" RuntimeIdentifier="linux-x64" NuGetPackageId="System.Private.Runtime.UnicodeData" />
</ItemGroup>
This requires me to specify a NuGetPackageId and it has to be an actual package that the app references, so if I have a project that doesn't reference any NuGet packages, then I won't be able to do this.
Open questions
Should assets specify a RID or should the SDK assume it, based on the publish/build rid?
How should they be listed in the deps.json file? Under the built app library section? Under a new loose native assets section?
We need to make sure this works end-to-end on publish, packaging and as transitive dependencies as what if I have a reference to an app that depends on this loose native assets?
Notes
This will be a very important feature for ICU story since we're now providing a default behavior to use ICU on Windows and many customers will want to use the same version or a custom version with custom locales in their app across different OSs.
cc: @dsplaisted @ericstj @jkotas @tarekgh @eerhardt @jeffschwMSFT
In dotnet/runtime we're currently enabling a feature for applications to carry their own copy of ICU for globalization purposes instead of using system-wide installed ICU.
In order to make this feature work, we're using
NativeLibrary.TryLoadAPI which uses some probing usingNATIVE_DLL_SEARCH_DIRECTORIESproperty passed by the host to the runtime. However, this property is populated based of the deps.json file, so if we don't have any native assets coming from NuGet packages or we want to use a different folder for our custom built native assets, we wont be able to load from there asNATIVE_DLL_SEARCH_DIRECTORIESwill not include this directory. This is of course blocking for framework dependent apps as for self contained appsNATIVE_DLL_SEARCH_DIRECTORIESincludes the app directory always.Currently the only way to have native assets included in deps.json file is via NuGet resolved assets, however, I did manage to do this by adding:
This requires me to specify a NuGetPackageId and it has to be an actual package that the app references, so if I have a project that doesn't reference any NuGet packages, then I won't be able to do this.
Open questions
Should assets specify a RID or should the SDK assume it, based on the publish/build rid?
How should they be listed in the deps.json file? Under the built app library section? Under a new loose native assets section?
We need to make sure this works end-to-end on publish, packaging and as transitive dependencies as what if I have a reference to an app that depends on this loose native assets?
Notes
This will be a very important feature for ICU story since we're now providing a default behavior to use ICU on Windows and many customers will want to use the same version or a custom version with custom locales in their app across different OSs.
cc: @dsplaisted @ericstj @jkotas @tarekgh @eerhardt @jeffschwMSFT