UWP Application
Why Can't I use ML.NET in UWP apps?
@GalOshri would probably be able to answer this question.
Hi @Jahanaray, is there a specific error you are encountering?
I just tried creating a UWP app targeting the "Windows 10 Fall Creators Update" as the min version (based on this and using x64. I was able to train an ML.NET model and use it for predictions. x86 support for ML.NET is in progress.
/cc @eerhardt in case there is a known issue
ML.NET is a netstandard2.0 library. So you need to use a UWP version that supports .NET Standard 2.0. See https://blogs.msdn.microsoft.com/dotnet/2017/10/10/announcing-uwp-support-for-net-standard-2-0/ for more details.
@GalOshri @eerhardt Thanks for your kind response and sorry for late reply. I am using last version of UWP sdk which is 17134 (x64). I know it's weird but it seems the problem is in copying the trained library (model.zip) into debug folder, I have done this manually (copying the library into debug folder!) and it worked. Maybe I should mention that it doesn't work normally, until I put my code into a try_catch. I guess (it's only my guess) it has something with my windows and sdk update because when I had the last version once I tested ML.NET on UWP app and it worked.
I know it's weird but it seems the problem is in copying the trained library (model.zip) into debug folder, I have done this manually (copying the library into debug folder!) and it worked.
@Jahanaray - do other files get copied to the debug folder correctly? Like if you add a .txt file to your project, set its properties to be Copy to Output Directory = Copy Always? Does the .txt file get copied correctly?
@eerhardt - Good point and funny mistake for me! I didn't consider this possibility, since I have test this out before. After checking out again, it turned out that problem is not from ML.NET and is global, I can't read even a text file! So do you have any suggestion in that case?
Unfortunately, no, I don't have very good suggestions for it. Maybe try asking your question on stackoverflow, or through the "Send Feedback" option in Visual Studio.
Does the problem reproduce in even a Console Application? If so, then I would say your Visual Studio installation may have a problem. If it is only UWP projects, then it may be specific to the UWP sdk you installed.
Closing as this doesn't appear to be an issue with ML.NET.
Thanks, it is just with UWP app, I may have to reinstall my sdk or VS.
@eerhardt @GalOshri - (maybe helpful for others) I checked the problem again after solving the problem in copying library (model.zip), it seems the main problem was causing by updating to the new version of ML.NET. I make my model library using console app with previous version of ML.NET and was trying to read it using new version of ML.NET. It turns out it's not possible and you should train it again using new version of ML.NET.
Adding a related sample app which mentions related issues: https://xamlbrewer.wordpress.com/2019/01/25/machine-learning-with-ml-net-in-uwp-clustering/