Add build targets and props file for legacy csharp project support (#127)

* added the x64 condition in the targets file

* need the reference node for managed dll

* address review comments

* fix the dll path

* added back Link
This commit is contained in:
shahasad 2018-12-07 12:15:11 -08:00 committed by GitHub
parent 19c630b87f
commit a09a3d3aa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 0 deletions

View file

@ -63,6 +63,18 @@
Pack="true"
Visible="false"
/>
<None Include="Microsoft.ML.OnnxRuntime.targets"
PackagePath="\build\$(TargetFramework)"
Pack="true"
Visible="false"
/>
<None Include="Microsoft.ML.OnnxRuntime.props"
PackagePath="\build\$(TargetFramework)"
Pack="true"
Visible="false"
/>
</ItemGroup>
<Target Name="ObtainPackageVersion" BeforeTargets="Build;Pack">

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="Exists('packages.config') OR
Exists('$(MSBuildProjectName).packages.config') OR
Exists('packages.$(MSBuildProjectName).config')">
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win10-x64\native\onnxruntime.dll"
Condition="'$(PlatformTarget)' == 'x64'">
<Link>onnxruntime.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win10-x64\native\mkldnn.dll"
Condition="'$(PlatformTarget)' == 'x64'">
<Link>mkldnn.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
</ItemGroup>
</Project>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Microsoft_ML_OnnxRuntime_CheckPrerequisites" BeforeTargets="BeforeBuild">
<!--
Special case .NET Core portable applications. When building a portable .NET Core app,
the PlatformTarget is empty, and you don't know until runtime (i.e. which dotnet.exe)
what processor architecture will be used.
-->
<Error Condition="'$(PlatformTarget)' != 'x64' AND
('$(OutputType)' == 'Exe' OR '$(OutputType)'=='WinExe') AND
!('$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(PlatformTarget)' == '') AND
'$(SuppressOnnxRuntimePlatformCompatibilityError)' != 'true'"
Text="Microsoft.ML.OnnxRuntime only supports the x64 platform at this time."/>
</Target>
</Project>