none
How to include Windows.Ai.Machinelearning into a C# program ?

    Question

  • Hi. I'm trying to use winML with c# to do some projects. I currently can't include a lot of libraries into my project as I tried to do the machine learning tutorial from microsoft . I need to include the following dependancies into my program :

    using Windows.Storage;
    using System.Windows.Graphics.Imaging;
    using System.Windows.Storage.Streams;
    using System.Windows.AI.MachineLearning.Preview;
    using System.Windows.Foundation;
    using System.Windows.Media;

    However visual studio tells me that they are all no recognized. I have a :

    Windows 10 Professional version 1809 (build 17763.253)

    Microsoft visual studio 2017 with Windows 10 SDK (10.0.17763.0)

    Thank you for your help in advance

    Tuesday, February 12, 2019 12:03 AM

All replies

  • Hi VV19,

    Welcome to MSDN forum.

    As for this issue, I can’t reproduce it in my side. And about the tutorial you mentioned above, does it refer to this document?

    In my machine(windows 1803), if I create a blank UWP app, I can include dependences like below:

    using Windows.Storage;
    using Windows.Graphics.Imaging;
    using Windows.Storage.Streams;
    using Windows.AI.MachineLearning.Preview;
    using Windows.Foundation;
    using Windows.Media;

    And if I open the tutorial sample, the dependences should be like what shows below:


    So I think what you need is to include dependences whose prefix is ‘windows.’ Instead of ‘system. windows’ . For more details about WinRt apis see here.

    And to follow the tutorial, please make sure we download the entire windows-Machine-Learning resource. After Extract it, navigate to “Windows-Machine-Learning-master\Samples\MNIST\Tutorial\cs” folder, open the MNIST_Demo.sln with vs2017. And after that, I think you can get a good start for this tutorial.

    In addition: Don’t forget add new existing item from asserts to mnist.onnx, so that mnist.cs can display and work.

    Hope all above can help solve your issue. Any update please feel free to share here. We are looking forward to your reply!

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, February 12, 2019 6:36 AM
  • Check the tutorial with regards to the type of application: Forms, UWP, WPF, Console? Some of ‘using’ can be only used in specific kinds of programs.

    In order to use ML, see, for example, the “Install the Microsoft.ML NuGet Package” section: https://docs.microsoft.com/en-us/dotnet/machine-learning/tutorials/sentiment-analysis.

    Tuesday, February 12, 2019 6:55 AM
  • Hi friend,

    Haven't heard from you.If there has any update, please feel free to contact us.

    Looking forward to your reply!

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 18, 2019 6:18 AM