Skip to content

Commit

Permalink
Add netstandard2.0 framework to nuget managed package. (#8960)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
skottmckay authored Sep 3, 2021
1 parent a0c9408 commit eebcc20
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ 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
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
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -139,10 +139,10 @@
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"
Visible="false"
/>

<!-- Some tools to be packaged in nightly build only, should not be released -->
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
'$(SuppressOnnxRuntimePlatformCompatibilityError)' != 'true'"
Text="Microsoft.ML.OnnxRuntime only supports the AnyCPU, x64, and x86 platforms at this time."/>
</Target>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 10 additions & 6 deletions tools/nuget/generate_nuspec_for_native_nuget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" />')
Expand Down

0 comments on commit eebcc20

Please sign in to comment.