Skip to content

Commit

Permalink
update Onnxrunitme.CSharp.proj
Browse files Browse the repository at this point in the history
  • Loading branch information
mszhanyi committed Dec 16, 2023
1 parent ce99728 commit 87cf991
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
13 changes: 8 additions & 5 deletions csharp/OnnxRuntime.CSharp.proj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CMake creates a target to this project
<IsWindowsBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindowsBuild>
<IsLinuxBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinuxBuild>
<ExecutionProvider Condition=" '$(ExecutionProvider)' == '' ">None</ExecutionProvider>
<IsDependentPackage Condition=" '$(IsDependentPackage)' == '' ">false</IsDependentPackage>

<!-- include Xamarin/MAUI Android and iOS target frameworks? Command line property overrides this value. -->
<IncludeMobileTargets>true</IncludeMobileTargets>
Expand Down Expand Up @@ -81,8 +82,10 @@ CMake creates a target to this project
<Output TaskParameter="AbsolutePaths" PropertyName="OnnxRuntimeSourceDirectoryAbs"/>
</ConvertToAbsolutePath>
<PropertyGroup>
<CurrentDate>$([System.DateTime]::UtcNow.ToString(yyyyMMdd))</CurrentDate>
<CurrentTime>$([System.DateTime]::UtcNow.ToString(hhmm))</CurrentTime>
<!-- If we create multiple nuget packages in one job, major package and dependent packages version should be the same-->
<!-- CurrentDate and CurrentTime are only used for dev packages-->
<CurrentDate Condition="'$(CurrentDate)'==''">$([System.DateTime]::UtcNow.ToString(yyyyMMdd))</CurrentDate>
<CurrentTime Condition="'$(CurrentTime)'==''">$([System.DateTime]::UtcNow.ToString(hhmm))</CurrentTime>
<PackageVersion>@(MajorVersionNumber)</PackageVersion>
<PackageVersion>$(PackageVersion)$(ReleaseVersionSuffix)</PackageVersion>
<Version>$(PackageVersion)</Version>
Expand All @@ -100,10 +103,10 @@ CMake creates a target to this project
</Exec>

<!-- Create Microsoft.ML.OnnxRuntime.Managed with the C# bindings using the C# project -->
<Message Importance="High" Text="Creating Microsoft.ML.OnnxRuntime.Managed nuget package..." />
<MSBuild Projects="src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj"
<Message Condition="'$(IsDependentPackage)'!='True'" Importance="High" Text="Creating Microsoft.ML.OnnxRuntime.Managed nuget package..." />
<MSBuild Condition="'$(IsDependentPackage)'!='True'" Projects="src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj"
Targets="CopyMiscFiles;Pack"
Properties="NoBuild=true;Platform=AnyCPU;PackageVersion=$(PackageVersion);OrtPackageId=$(OrtPackageId);IncludeMobileTargets=$(IncludeMobileTargets)"/>
Properties="NoBuild=true;Platform=AnyCPU;PackageVersion=$(PackageVersion);OrtPackageId=$(OrtPackageId);IncludeMobileTargets=$(IncludeMobileTargets)"/>

<!-- Manually create the nuspec for the native Microsoft.ML.OnnxRuntime package -->
<Message Importance="High" Text="Generating nuspec for the native Microsoft.ML.OnnxRuntime nuget package..." />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,8 @@ stages:
variables:
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
CurrentDate: $[format('{0:yyyyMMdd}', pipeline.startTime)]
CurrentTime: $[format('{0:HHmm}', pipeline.startTime)]

steps:
- checkout: self
Expand Down Expand Up @@ -813,6 +815,10 @@ stages:
platform: 'Any CPU'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
env:
# check out csharp/OnnxRuntime.CSharp.proj for the usage of these variables
CurrentDate: $(CurrentDate)
CurrentTime: $(CurrentTime)

- task: MSBuild@1
displayName: 'Build Nuget Packages Microsoft.ML.OnnxRuntime.Gpu-win'
Expand All @@ -822,6 +828,11 @@ stages:
platform: 'Any CPU'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu-win -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
env:
# check out csharp/OnnxRuntime.CSharp.proj for the usage of these variables
CurrentDate: $(CurrentDate)
CurrentTime: $(CurrentTime)
IsDependentPackage: 'True'

- task: MSBuild@1
displayName: 'Build Nuget Packages Microsoft.ML.OnnxRuntime.Gpu-linux'
Expand All @@ -831,6 +842,11 @@ stages:
platform: 'Any CPU'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu-linux -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
env:
# check out csharp/OnnxRuntime.CSharp.proj for the usage of these variables
CurrentDate: $(CurrentDate)
CurrentTime: $(CurrentTime)
IsDependentPackage: 'True'

- task: BatchScript@1
displayName: 'Add TensorRT header file to the native nuGet package'
Expand Down

0 comments on commit 87cf991

Please sign in to comment.