Skip to content

Add instructions for building for .NET Core 3.0, and make them work. #1032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
<Configurations>Debug;Release;Debug-Intrinsics;Release-Intrinsics</Configurations>
<Platform Condition="'$(Platform)'==''">AnyCPU</Platform>
<NativeTargetArchitecture Condition="'$(NativeTargetArchitecture)' == ''">x64</NativeTargetArchitecture>
<PlatformConfig>$(Platform).$(Configuration)</PlatformConfig>
Expand Down Expand Up @@ -106,6 +107,16 @@
<UseIntrinsics Condition="'$(UseIntrinsics)' == ''">$(Configuration.EndsWith('-Intrinsics'))</UseIntrinsics>
</PropertyGroup>

<!-- Need to explicitly set these properties for the -Intrinsics configurations becuase they are typically based off 'Debug' or 'Release' configs -->
<!-- Taken from https://github.com/dotnet/sdk/blob/073c98b92c81066c6c2e17c3674adbb6e833409a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props#L41-L47 -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug-Intrinsics'">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release-Intrinsics'">
<Optimize>true</Optimize>
</PropertyGroup>

<PropertyGroup>
<CustomAfterMicrosoftCommonTargets>$(RepoRoot)build\AfterCommonTargets.targets</CustomAfterMicrosoftCommonTargets>
</PropertyGroup>
Expand Down
320 changes: 160 additions & 160 deletions Microsoft.ML.sln

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions docs/building/netcoreapp3.0-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
In order to build ML.NET for .NET Core 3.0, you need to do a few manual steps.

1. Pick a version of the .NET Core 3.0 SDK you want to use. As of this writing, I'm using `3.0.100-alpha1-009622`. You can get the latest available version from the [dotnet/core-sdk README](https://github.com/dotnet/core-sdk#installers-and-binaries) page.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pick [](start = 3, length = 4)

Thanks for adding this @eerhardt -- I found this impossibly confusing myself without asking you, I'm not sure how someone who didn't know the right person to ask would manage. :)

2. Change the [DotnetCLIVersion.txt](https://github.com/dotnet/machinelearning/blob/master/DotnetCLIVersion.txt) file to use that version number.
3. Delete the local `.\Tools\` folder from the root of the repo, to ensure you download the new version.
4. Run `.\build.cmd -- /p:Configuration=Release-Intrinsics` from the root of the repo.
5. If you want to build the NuGet packages, `.\build.cmd -buildPackages` after step 4.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VS studio option is working for testing. But it will be nice to add the appropriate command to run all the tests from the command line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with the latest.

Now you can run tests just like normal:

Run .\build.cmd -- /p:Configuration=Release-Intrinsics from the root of the repo.
Run .\build.cmd -runTests -- /p:Configuration=Release-Intrinsics from the root of the repo.


If you are using Visual Studio, you will need to do the following:

1. Install the above .NET Core 3.0 SDK into %Program Files%. Or extract it to a directory and put that directory at the front of your %PATH%, so it is the first `dotnet.exe` on the PATH.
2. In the Configuration Manager, switch the current configuration to `Debug-Intrinsics` or `Release-Intrinsics`.
3. Build and test as usual.
3 changes: 0 additions & 3 deletions src/Microsoft.ML.CpuMath/Microsoft.ML.CpuMath.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configurations>Debug;Release;Debug-Intrinsics;Release-Intrinsics</Configurations>
<TargetFramework Condition="'$(UseIntrinsics)' != 'true'">netstandard2.0</TargetFramework>
<TargetFrameworks Condition="'$(UseIntrinsics)' == 'true'">netstandard2.0;netcoreapp3.0</TargetFrameworks>
<IncludeInPackage>Microsoft.ML.CpuMath</IncludeInPackage>
Expand All @@ -23,8 +22,6 @@

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<Compile Remove="CpuMathUtils.netstandard.cs" />
<!-- This is only needed until https://github.com/dotnet/corefx/issues/31064 is addressed. -->
<PackageReference Include="System.Runtime.Intrinsics.Experimental" Version="4.6.0-preview1-26708-04" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you're deleting this because this is now inbox in 3.0? Or am I missing something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. https://github.com/dotnet/corefx/issues/31064 has been fixed for some time.

</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
Expand Down
5 changes: 4 additions & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<Import Project="..\Directory.Build.props" />

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<DefaultTestTargetFramework>netcoreapp2.1</DefaultTestTargetFramework>
<DefaultTestTargetFramework Condition="'$(UseIntrinsics)' == 'true'">netcoreapp3.0</DefaultTestTargetFramework>

<TargetFramework>$(DefaultTestTargetFramework)</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<!-- Empty TargetFramework because test\Directory.Build.props sets TFM, but FSharp.Tests is multi-targeted -->
<TargetFramework></TargetFramework>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>$(DefaultTestTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Unix'">$(TargetFrameworks); net461</TargetFrameworks>
<NoWarn>2003;$(NoWarn)</NoWarn>
<PublicSign>false</PublicSign>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
<ProjectReference Include="..\..\src\Microsoft.ML.Maml\Microsoft.ML.Maml.csproj" />
Expand Down