Add netstandard2.0 target to OnnxRuntime.Managed package#8600
Add netstandard2.0 target to OnnxRuntime.Managed package#8600skottmckay merged 1 commit intomicrosoft:masterfrom
Conversation
|
/azp run Linux CPU CI Pipeline,Linux CPU x64 NoContribops CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,MacOS CI Pipeline,MacOS NoContribops CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline |
|
/azp run orttraining-linux-ci-pipeline,orttraining-mac-ci-pipeline,orttraining-linux-gpu-ci-pipeline,Linux OpenVINO CI Pipeline,centos7_cpu |
|
Azure Pipelines successfully started running 4 pipeline(s). |
|
Azure Pipelines successfully started running 9 pipeline(s). |
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>netstandard1.1</TargetFramework> | ||
| <TargetFrameworks>netstandard1.1;netstandard2.0</TargetFrameworks> |
There was a problem hiding this comment.
Does this change increase the size of the binary produced?
There was a problem hiding this comment.
Afaik no. I didn't look deeply into the packages generated by our build process here before and after, but in general adding a new target does not change the existing target's binary but produces an additional binary, that is included in the nuget package. See e.g. [0] for an example (screenshot of the latest version of the Netwonsoft.Json package opened in NuGetPackageExplorer). When one adds the reference to their project, the SDK decides during the build which version suits best and just uses that one binary. Specifically, when adding a ns2.0 target, all consuming projects that support ns2.0 will use that ns2.0 binary by default, while consumers that do support ns1.1 but not ns2.0 will use the older target. Thus, this might increase the NuGet package download size a tiny bit (the managed lib is just 115kb before compression in the package), for the advantage of the greatly simplified dependency graph, but afaik multi targeting does not increase the deployed binaries' sizes.
|
/azp run Linux CPU Minimal Build E2E,Linux Nuphar CI Pipeline,Windows WebAssembly CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-ortmodule-distributed |
|
Azure Pipelines successfully started running 4 pipeline(s). |
|
/azp run Linux CPU Minimal Build E2E CI |
|
No pipelines are associated with this pull request. |
|
/azp run Windows GPU CI Pipeline |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Linux CPU Minimal Build E2E CI Pipeline |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Windows GPU CI Pipeline |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
CCing @joperezr and @ericstj, given you authored dotnet/runtime#39099 Also looking at Cross-platform targeting docs:
Would it be advisable to add a Hope it's okay asking you, despite this isn't your project. I thought you might be the best ones to ask, given you were involved in the reasoning of including such targets in the packages of the runtime repo. |
|
No trouble to ask, happy to help. You can also add a One thing to be careful about as you add more TargetFrameworks to the package is that compatible frameworks have compatible API. You can add more API on newer frameworks, but not vice-versa. To help you get it correct our team has built a new feature you might want to try: https://devblogs.microsoft.com/dotnet/package-validation/ Feel free to reach out or tag us in issues if you have more questions. Cheers! |
|
Thanks for the recommendations and your willingness to help! I don't know how many consumers are on [4.6.1 - 4.7.1] (if I'd guess I'd say probably not too many but I really don't know), so this is probably something @skottmckay or other team members could consider as a future step if they feel it's relevant. Also thanks for refering to the great new package validation feature. I already tried it in a tiny side project and really like how it works. |
This reverts commit e673d2e.
Initially added in #8600 but backed out due to breaking the packaging pipeline. Re-add with update to the nuspec generation script. There's slighly more structure to the location of the props and targets file in preparation for adding more platforms in the near future.

Description: Add netstandard2.0 as a target framework for the
Microsoft.ML.OnnxRuntime.Managedpackage.Motivation and Context
Why is this change required? What problem does it solve?
netstandard2.0additionally is recommended by the corresponding docsThis seems to be a quite easy change, so I'm not sure if it wasn't made for a reason. I tried searching for related PRs/issues but did not find any.