I am working on a project in VS 2019 and am trying to use the latest winrt/c++ machine learning api. Therefore I conducted the following steps:
Cannot open microsoft.ai.machinelearning.h from NuGet package
When you install the nuget package Microsoft.AI.MachineLearning 1.4.0
, you should use this
#include "abi/Microsoft.AI.MachineLearning.h"
Actually, Microsoft.AI.MachineLearning.h
file exists under the abi folder from your nuget package.
================
Update 1
I have reproduced your issue in my side. And it seems that there is no such error in my side. I just create such project followed by the above document, then install that nuget package-->build the project and after that, I can call `winrt/Microsoft.AI.MachineLearning.h.
And the winrt c++ project just puts such file into Generated Files folder during build process based on the function of the project.
So it is a quite strange behavior, and I suggest you could follow these steps to troubleshoot it:
Before all, you could check this document first.
1) First, close your Windows Console Application (C++/WinRT)
project, delete .vs
hidden folder, any output folders like Debug or Release under the solution folder and project folder.
2) Then restart your project and make sure that Microsoft.AI.MachineLearning 1.4.0
NuGet package is installed.
Then rebuild your project and make sure that build process is successful.
3) Then I can call #include "winrt/Microsoft.AI.MachineLearning.h"
.
If these steps do not help, I think VS or your current project itself has something wrong.
please try to disable any other third party extensions under Extensions-->Manage Extensions and then restart VS to test it.
Or just create a new WinRT C++ project to test whether the issue happens in the new project.