Add netstandard2.0 framework to nuget managed package. (#8960)

* Add netstandard2.0 to nuget managed package.
Re-does PR that was backed out due to packaging pipeline changes.
Allows deprecation of netstandard1.1 in the following release as netstandard2 is the preferred lowest level framework.
This commit is contained in:
Scott McKay 2021-09-04 08:01:46 +10:00 committed by GitHub
parent a0c9408f0d
commit eebcc20f10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 20 deletions

7
.gitignore vendored
View file

@ -30,6 +30,7 @@ onnxruntime_profile*.json
/docs/python/inference/examples/*.onnx
/docs/python/inference/examples/graph.*
/docs/python/*_LICENSE
/LICENSE.txt
/csharp/**/obj/
/csharp/**/bin/
/csharp/Directory.Build.props
@ -37,8 +38,8 @@ docs/python/inference/*.onnx
*.onnx
onnxprofile_profile_test_*.json
/csharp/packages
/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.targets
/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.props
/csharp/src/Microsoft.ML.OnnxRuntime/targets/**/*.targets
/csharp/src/Microsoft.ML.OnnxRuntime/targets/**/*.props
cmake/external/FeaturizersLibrary/
# Java specific ignores
java/gradlew
@ -53,7 +54,7 @@ onnxruntime/python/version_info.py
/tools/perf_util/src/main/resources
/orttraining/orttraining/eager/ort_aten.g.cpp
/orttraining/orttraining/eager/ort_customops.g.cpp
/csharp/**/packages
# direnv, posh-direnv
.envrc
.psenvrc

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<TargetFrameworks>netstandard1.1;netstandard2.0</TargetFrameworks>
<Platforms>AnyCPU;x86</Platforms>
<LangVersion>7.2</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -139,8 +139,8 @@
Pack="true"
Visible="false"
/>
<None Include="$(PackageId).targets"
PackagePath="\build\$(TargetFramework)"
<None Include="targets\netstandard\$(PackageId).targets"
PackagePath="build\netstandard1.1\$(PackageId).targets;build\netstandard2.0\$(PackageId).targets"
Pack="true"
Visible="false"
/>
@ -163,18 +163,18 @@
</ItemGroup>
<ItemGroup>
<LicenseFile Include="$(OnnxRuntimeCsharpRoot)\..\LICENSE" />
<TargetsFile Include="$(OnnxRuntimeCsharpRoot)\src\Microsoft.ML.OnnxRuntime\targets.xml" />
<LicenseFile Include="$(OnnxRuntimeCsharpRoot)\..\LICENSE" Visible="false" />
<TargetsFile Include="$(OnnxRuntimeCsharpRoot)\src\Microsoft.ML.OnnxRuntime\targets\netstandard\targets.xml" Visible="false" />
</ItemGroup>
<Target Name="CopyMiscFiles" BeforeTargets="Pack">
<Copy SourceFiles="@(LicenseFile)" DestinationFiles="@(LicenseFile->'$(OnnxRuntimeCsharpRoot)\..\%(Filename).txt')" />
<Copy SourceFiles="@(TargetsFile)" DestinationFiles="@(TargetsFile->'$(OnnxRuntimeCsharpRoot)\src\\Microsoft.ML.OnnxRuntime\$(PackageId).targets')" />
<Copy SourceFiles="@(TargetsFile)" DestinationFiles="@(TargetsFile->'$(OnnxRuntimeCsharpRoot)\src\Microsoft.ML.OnnxRuntime\targets\netstandard\$(PackageId).targets')" />
</Target>
<Target Name="CopyPackage" AfterTargets="Pack">
<Copy
SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg"
SourceFiles="$(OutputPath)\$(PackageId).$(PackageVersion).nupkg"
DestinationFolder="$(NativeBuildOutputDir)\nuget-artifacts"
/>
</Target>

View file

@ -12,5 +12,4 @@
'$(SuppressOnnxRuntimePlatformCompatibilityError)' != 'true'"
Text="Microsoft.ML.OnnxRuntime only supports the AnyCPU, x64, and x86 platforms at this time."/>
</Target>
</Project>

View file

@ -121,6 +121,7 @@ jobs:
pool: 'Win-CPU-2021'
dependsOn:
- Linux_C_API_Packaging_GPU_x64
- Linux_C_API_Packaging_GPU_TensorRT_x64
- Windows_Packaging_gpu
- Windows_Packaging_tensorrt
condition: succeeded()

View file

@ -515,20 +515,24 @@ def generate_files(list, args):
if is_cpu_package or is_cuda_gpu_package or is_dml_package or is_mklml_package:
# Process props file
source_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'props.xml')
target_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime',
args.package_name + '.props')
source_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'targets',
'netstandard', 'props.xml')
target_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'targets',
'netstandard', args.package_name + '.props')
os.system(copy_command + ' ' + source_props + ' ' + target_props)
files_list.append('<file src=' + '"' + target_props + '" target="build\\native" />')
files_list.append('<file src=' + '"' + target_props + '" target="build\\netstandard1.1" />')
files_list.append('<file src=' + '"' + target_props + '" target="build\\netstandard2.0" />')
# Process targets file
source_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'targets.xml')
target_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime',
args.package_name + '.targets')
source_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'targets',
'netstandard', 'targets.xml')
target_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'targets',
'netstandard', args.package_name + '.targets')
os.system(copy_command + ' ' + source_targets + ' ' + target_targets)
files_list.append('<file src=' + '"' + target_targets + '" target="build\\native" />')
files_list.append('<file src=' + '"' + target_targets + '" target="build\\netstandard1.1" />')
files_list.append('<file src=' + '"' + target_targets + '" target="build\\netstandard2.0" />')
# Process License, ThirdPartyNotices, Privacy
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'LICENSE.txt') + '" target="LICENSE.txt" />')