Skip to content

Using ML.Net in Classic Windows Console or WPF App #357

Closed

Description

@mairaw

@Dirkster99 commented on Wed Jun 13 2018

I am currently evaluating the ML.Net library and get it to run with .Net Core:
https://github.com/Dirkster99/ML

but I would like to also run it within a classic Windows console or WPF app (eg .Net 4.5.2).

Is it possible to do this with the current Nuget?
My problem is that when I try to install the ML.Net Nuget package - the package manager says its installed (see output below). But the ML.Net package never shows up in the references section and I find it, thus, hard to use it in this context.

Is this a current limitation of VS or an issue with the ML.Net nuget package? Is there a workaround solution?

Package Manager output log:
Attempting to gather dependency information for package 'Microsoft.ML.0.2.0' with respect to project 'Classifier', targeting '.NETFramework,Version=v4.5.2'
Gathering dependency information took 70.64 ms
Attempting to resolve dependencies for package 'Microsoft.ML.0.2.0' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.ML.0.2.0'
Resolved actions to install package 'Microsoft.ML.0.2.0'
Retrieving package 'Microsoft.ML 0.2.0' from 'nuget.org'.
Adding package 'Microsoft.ML.0.2.0' to folder 'C:\Users\NOP\Desktop\Classifier\packages'
Added package 'Microsoft.ML.0.2.0' to folder 'C:\Users\NOP\Desktop\Classifier\packages'
Added package 'Microsoft.ML.0.2.0' to 'packages.config'
Successfully installed 'Microsoft.ML 0.2.0' to Classifier
Executing nuget actions took 1.05 sec
Time Elapsed: 00:00:01.3016144
========== Finished ==========
screenshot

Activity

  1. danmoseley commented on Jun 15, 2018

    @danmoseley

    I dot not know why this does not work. @eerhardt do you have ideas of possible causes for this?

  2. eerhardt commented on Jun 15, 2018

    @eerhardt
    Member

    From your Package Manager output (thanks for the log - it helps a ton in figuring out what is going wrong), I see you are targeting .NET Framework v4.5.2.

    Microsoft.ML targets netstandard2.0. Unfortunately, netstandard2.0 libraries are not compatible with .NET Framework v4.5.2. Instead, please re-target your project to v4.6.1 or higher in order to work with Microsoft.ML.

    To read more about netstandard and its mapping to the .NET Framework, check out https://docs.microsoft.com/en-us/dotnet/standard/net-standard.

  3. glebuk commented on Jun 15, 2018

    @glebuk
    Contributor

    Maira, @Dirkster99,
    Please take a look at PR #248 for a nifty command line tool that allows you to run variety of ML.NET jobs from the classic console.

  4. mairaw commented on Jun 15, 2018

    @mairaw
    ContributorAuthor

    The original issue is actually from @Dirkster99 not me. I just moved it here. 😄

  5. Dirkster99 commented on Jun 17, 2018

    @Dirkster99

    I am fine with the limitation if its a known limitation I suggest we:

    1. make sure its documented - so far the documentation only stated that ML.Net can be used in a classic .Net application (I think I saw that somewhere).

    2. What I find strange though is that the Package Manager says its installed when the reference is not showing up. It would be great if this problem could be tracked down and be re-solved, such that others do not get the same weird experience, because I would expect a package to be either installed or not, right?

  6. Dirkster99 commented on Jun 18, 2018

    @Dirkster99

    #366 Looks like a duplicate to me - it does not seem like targeting 4.6.1 resolves this either...

  7. added a commit that references this issue on Jun 18, 2018
    c1b1615
  8. eerhardt commented on Jun 18, 2018

    @eerhardt
    Member

    After a little more investigation, I figured out why the package is installing successfully, even when the project is targeting an unsupported framework version. I've created a PR to fix the NuGet package so NuGet will raise an error when installing on unsupported frameworks again.
    Thanks for the help in finding and reporting this issue, @Dirkster99.

    As far as I can tell, #366 is a different issue. In this case (#357), the scenario should not work. In #366, the scenario should work. The difference is targeting net461 and above should work because we are using netstandard2.0.

  9. Dirkster99 commented on Jun 18, 2018

    @Dirkster99

    Cool - @mairaw Can you make sure the documentation lists the supported versions of the different .Net frameworks including those versions that are supported by netstandard2.0 (.Net 4.6.1)? I think that would be very helpful for everyone wanting to consider this in their own app ...

  10. mairaw commented on Jun 18, 2018

    @mairaw
    ContributorAuthor

    @JRAlexander can you open an issue in dotnet/docs to add information about which versions are supported by ML.NET? Perhaps this could go to the homepage (https://docs.microsoft.com/en-us/dotnet/machine-learning/)?

    For versions supported by a specific .NET Standard version, I'd just link to https://docs.microsoft.com/en-us/dotnet/standard/net-standard for more info.

  11. added a commit that references this issue on Jun 18, 2018
    84cb59e
  12. JRAlexander commented on Jun 18, 2018

    @JRAlexander

    Yes, I will do that!

  13. added a commit that references this issue on Jun 27, 2018
    185912b
  14. added a commit that references this issue on Jul 27, 2018
    ea3a563
  15. ghost locked as resolved and limited conversation to collaborators on Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions