Skip to content

Commit

Permalink
Revert "Nuget .NET changes for Mac Catalyst (#19923)" (#20418)
Browse files Browse the repository at this point in the history
This reverts commit f396748.

### Description
<!-- Describe your changes. -->



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
  • Loading branch information
mszhanyi committed Apr 23, 2024
1 parent e6a677f commit 7ebc653
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 112 deletions.
2 changes: 1 addition & 1 deletion csharp/ApiDocs/ApiDocs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/ApiDocs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"disableDefaultFilter": false,
"properties": {
"AllowUnsafeBlocks": true,
"TargetFramework" : "net7.0",
"TargetFramework" : "net6.0",
"Nullable" : "enable",
"LangVersion": "8.0",
"EnableTrainingApis": "true"
Expand Down
4 changes: 2 additions & 2 deletions csharp/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ For example, to build a CUDA GPU package, just run:
--cudnn_home=/usr \
--build_nuget \
--msbuild_extra_options \
/p:SelectedTargets=Net7 \
/p:Net6Targets=net7.0 \
/p:SelectedTargets=Net6 \
/p:Net6Targets=net6.0 \
/p:TargetFrameworks=netstandard2.0 \
/p:IsLinuxBuild=true
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- note net7.0-maccatalyst is not supported currently. requires a new native build to be added. -->
<TargetFrameworks>net7.0-android;net7.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<!-- note net6.0-maccatalyst is not supported currently. requires a new native build to be added. -->
<TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Microsoft.ML.OnnxRuntime.InferenceSample.Maui</RootNamespace>
<UseMaui>true</UseMaui>
Expand Down Expand Up @@ -36,7 +36,7 @@
</PropertyGroup>

<ItemGroup>
<!-- NOTE:
<!-- NOTE:
You need to manually put builds from other platforms such as Android in the correct place for this to work for cross-platform
builds such as running in the Android simulator.
The 'correct' place is defined by the OnnxRuntimeBuildDirectory property in Microsoft.ML.OnnxRuntime.csproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<PropertyGroup>
<IncludeMobileTargets>true</IncludeMobileTargets>
<BaseTargets>netstandard2.0;netcoreapp3.1;net7.0</BaseTargets>
<BaseTargets>netstandard2.0;netcoreapp3.1;net6.0</BaseTargets>
<MobileTargets></MobileTargets>
</PropertyGroup>

Expand Down Expand Up @@ -39,12 +39,12 @@
<PropertyGroup Condition="('$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime' OR
'$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.Azure') AND
'$(IncludeMobileTargets)' == 'true'">
<MobileTargets>$(MobileTargets);net7.0-android;net7.0-ios;net7.0-maccatalyst</MobileTargets>
<MobileTargets>$(MobileTargets);net6.0-android;net6.0-ios</MobileTargets>
</PropertyGroup>

<PropertyGroup Condition="'$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.Training' AND
'$(IncludeMobileTargets)' == 'true'">
<MobileTargets>$(MobileTargets);net7.0-android</MobileTargets>
<MobileTargets>$(MobileTargets);net6.0-android</MobileTargets>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -121,9 +121,9 @@
<IsAndroidTarget Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' OR
$(TargetFramework.StartsWith('monoandroid'))">true</IsAndroidTarget>
<IsIOSTarget Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR
$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst' OR
$(TargetFramework.StartsWith('xamarinios'))">true</IsIOSTarget>
<IsMacTarget Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'macos'">true</IsMacTarget>
<IsMacTarget Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'macos' OR
$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">true</IsMacTarget>
</PropertyGroup>

<!-- Enable training APIs for the build. The native package must be
Expand Down Expand Up @@ -175,7 +175,7 @@
</PropertyGroup>

<!-- CoreML may be valid for one of these targets as they support macOS. we do a runtime check that the OS is
macOS before attempting to enable CoreML. This includes netcoreapp3.1 and net7.0
macOS before attempting to enable CoreML. This includes netcoreapp3.1 and net6.0
NOTE: $(TargetFrameworkIdentitier) may not be set yet, so we need to call GetTargetFrameworkIdentifier
-->
<PropertyGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)'))=='.NETCoreApp' AND
Expand Down

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\OnnxRuntime.snk</AssemblyOriginatorKeyFile>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(IsLinuxBuild)'=='true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<!-- netstandard2.0 is required by xamarin and used by most platforms.
net7.0 is required for linux. -->
<TargetFrameworks>netstandard2.0;net7.0</TargetFrameworks>
net6.0 is required for linux. -->
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<OnnxRuntimeCsharpRoot>$(ProjectDir)..\..</OnnxRuntimeCsharpRoot>
<Platforms>AnyCPU</Platforms>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<OnnxRuntimeCsharpRoot>$(ProjectDir)..\..</OnnxRuntimeCsharpRoot>
<Platforms>AnyCPU;x86</Platforms>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ stages:
- job:
workspace:
clean: all
# we need to use the 2022 pool to create the nuget package with both pre-net7+Xamarin and net7 targets.
# VS2019 has no support for net7 and we need to use msbuild (from the VS install) to do the packing
# we need to use the 2022 pool to create the nuget package with both pre-net6+Xamarin and net6 targets.
# VS2019 has no support for net6 and we need to use msbuild (from the VS install) to do the packing
pool: 'Onnxruntime-Win-CPU-2022'
variables:
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
Expand Down Expand Up @@ -675,7 +675,7 @@ stages:
inputs:
targetType: 'inline'
script: |
dotnet workload install android ios maccatalyst
dotnet workload install android ios
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: MSBuild@1
Expand Down Expand Up @@ -811,8 +811,8 @@ stages:
- job:
workspace:
clean: all
# we need to use the 2022 pool to create the nuget package with both pre-net7+Xamarin and net7 targets.
# VS2019 has no support for net7 and we need to use msbuild (from the VS install) to do the packing
# we need to use the 2022 pool to create the nuget package with both pre-net6+Xamarin and net6 targets.
# VS2019 has no support for net6 and we need to use msbuild (from the VS install) to do the packing
pool: 'Onnxruntime-Win-CPU-2022'
variables:
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
Expand Down Expand Up @@ -876,20 +876,20 @@ stages:
versionSpec: 6.2.1

- task: PowerShell@2
displayName: Build .NET 7 targets using dotnet
displayName: Build .NET 6 targets using dotnet
inputs:
targetType: 'inline'
# we don't specify 'Any CPU' as the platform here because if we do it gets added to the output path
# e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\Any CPU\RelWithDebInfo\net7.0-ios\
# which is inconsistent with the msbuild output path for the pre-.net7 targets
# e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\Any CPU\RelWithDebInfo\net6.0-ios\
# which is inconsistent with the msbuild output path for the pre-.net6 targets
# e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\monoandroid11.0
# and makes it harder to do the packing
#
# 'Any CPU' is the default (first 'mixed' platform specified in the csproj) so this should be fine.
script: |
dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj `
-p:SelectedTargets=Net7 `
/p:Net7Targets=net7.0 `
-p:SelectedTargets=Net6 `
/p:Net6Targets=net6.0 `
-p:Configuration=RelWithDebInfo `
-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" `
-p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm" `
Expand All @@ -898,22 +898,22 @@ stages:
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: MSBuild@1
displayName: 'Restore NuGet Packages and create project.assets.json for pre-.net7 targets'
displayName: 'Restore NuGet Packages and create project.assets.json for pre-.net6 targets'
inputs:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
platform: 'Any CPU'
configuration: RelWithDebInfo
msbuildArguments: '-t:restore -p:SelectedTargets=PreNet7 -p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"'
msbuildArguments: '-t:restore -p:SelectedTargets=PreNet6 -p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"'
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: MSBuild@1
displayName: 'Build C# for pre-.net7 targets'
displayName: 'Build C# for pre-.net6 targets'
inputs:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
configuration: RelWithDebInfo
platform: 'Any CPU'
msbuildArguments: >
-p:SelectedTargets=PreNet7
-p:SelectedTargets=PreNet6
-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)"
-p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"
-p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ stages:
pushd /onnxruntime_src/csharp; \
dotnet restore /onnxruntime_src/csharp/OnnxRuntime.DesktopOnly.CSharp.sln; \
dotnet build /onnxruntime_src/csharp/OnnxRuntime.DesktopOnly.CSharp.sln -c Release; \
dotnet test /onnxruntime_src/csharp/OnnxRuntime.DesktopOnly.CSharp.sln -c Release -f net7.0 --no-build -l \"console;verbosity=normal\"; \
dotnet test /onnxruntime_src/csharp/OnnxRuntime.DesktopOnly.CSharp.sln -c Release -f net6.0 --no-build -l \"console;verbosity=normal\"; \
popd
"
displayName: 'Dotnet build C# sln and Test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ stages:
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: PowerShell@2
displayName: Build .NET 7 targets using dotnet
displayName: Build .NET 6 targets using dotnet
inputs:
targetType: 'inline'
# we don't specify 'Any CPU' as the platform here because if we do it gets added to the output path
# e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\Any CPU\RelWithDebInfo\net7.0-ios\
# which is inconsistent with the msbuild output path for the pre-.net7 targets
# e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\Any CPU\RelWithDebInfo\net6.0-ios\
# which is inconsistent with the msbuild output path for the pre-.net6 targets
# e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\monoandroid11.0
# and makes it harder to do the packing
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ stages:
inputs:
targetType: 'inline'
script: |
dotnet workload install android ios maccatalyst
dotnet workload install android ios
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: MSBuild@1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ jobs:
WithCache: ${{parameters.WITH_CACHE}}
Today: $(Today)

- task: UseDotNet@2
inputs:
version: '7.x'
${{ if eq(parameters.isX86, true) }}:
env:
PROCESSOR_ARCHITECTURE: 'x86'

- task: NodeTool@0
inputs:
versionSpec: '18.x'
Expand Down Expand Up @@ -247,4 +240,4 @@ jobs:
condition: and(failed(), eq(variables['DocUpdateNeeded'], 'true'))
inputs:
pathtoPublish: '$(Build.SourcesDirectory)/docs/ContribOperators.md'
artifactName: 'ContribOperators.md'
artifactName: 'ContribOperators.md'
4 changes: 2 additions & 2 deletions tools/ci_build/github/linux/docker/scripts/install_dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e -x
if [ -f /etc/redhat-release ]; then
# If you found the following command went successfully but dotnet command still reports no sdk was found, most likely
# it was because the dotnet packages were installed from more than one dnf repos.
dnf install -y dotnet-sdk-7.0 dotnet-runtime-7.0
dnf install -y dotnet-sdk-6.0 dotnet-runtime-6.0
elif [ -f /etc/os-release ]; then
# Get Ubuntu version
declare repo_version
Expand All @@ -16,7 +16,7 @@ elif [ -f /etc/os-release ]; then
# Clean up
rm packages-microsoft-prod.deb
# Update packages
apt-get update && apt-get install -y dotnet-sdk-7.0
apt-get update && apt-get install -y dotnet-sdk-6.0
else
echo "Unsupported OS"
exit 1
Expand Down
Loading

0 comments on commit 7ebc653

Please sign in to comment.