ML.Net in .NET Framework Project

Sara Lane 1 Reputation point
2021-08-04T19:41:41.453+00:00

I have a Windows Forms project that targets the .NET Framework 4.6.1. I'd like to add machine learning capabilities to the project, so I added a new project that implements ML.NET. All of the projects in the solution are targeting x64.

The project works perfectly in the debugger, but I get the following error when I try running the published app:

System.DllNotFoundException
at Microsoft.ML.Internal.CpuMath.Thunk.DotU

I've tried using version 1.3.1 of ML.NET and I also installed Microsoft Visual C++ redistributable in the client machine but same result.

How can I resolve this or do I have no choice but to migrate my whole solution to .NET Core?

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,908 questions
.NET Machine learning
.NET Machine learning
.NET: Microsoft Technologies based on the .NET software framework.Machine learning: A type of artificial intelligence focused on enabling computers to use observed data to evolve new behaviors that have not been explicitly programmed.
159 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,631 Reputation points
    2021-08-05T01:53:42.707+00:00

    Hi SaraLane-2191,
    Please refer to the following suggestions:

    1. Open the package folder on your solution and browse \packages\Microsoft.ML.CpuMath.0.10.0\runtimes\win-x64\native, and copy it to your bin folder.
    2. Use PackageReference instead of packages.config.
      More details please refer to this blog.
    3. Include the ML.Net via .csproj file.
      And eerhardt has pionted out in this thread.
      Best Regards,
      Daniel Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.