Adding a reference does not work I get this from the .NET Core CLI:
Project `C:\test\test.Android\test.Android.csproj` could not be evaluated. Evaluation failed with following error:
The imported project "C:\Program Files\dotnet\sdk\3.1.401\Xamarin\Android\Xamarin.Android.Common.targets" was not found. Confirm that the expression in the Import declaration "Xamarin.Android.Common.targets" is correct, and that the file exists on disk. C:\Program Files\dotnet\sdk\3.1.401\Xamarin\Android\Xamarin.Android.CSharp.targets.
Usage: dotnet add <PROJECT> reference [options] <PROJECT_PATH>
Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
<PROJECT_PATH> The paths to the projects to add as references.
Options:
-h, --help Show command line help.
-f, --framework <FRAMEWORK> Add the reference only when targeting a specific framework.
--interactive Allows the command to stop and wait for user input or action (for example to complete authentication).
Anybody knows what might be the problem? I am using Windows 10 here and I tried adding a reference to another project. The same command works if I add the reference to an mgdesktopgl
or mgwindowsdx
project using the command line. So I assume it must be something specific to the mgandroid
project.
Also the command dotnet run
does not work and the reason is the same as above but I don’t know how to fix it. I installed everything I think that is required as described in the official documentation.
$ dotnet new mgandroid -o MyGame
The template "MonoGame Android Application" was created successfully.
$ cd MyGame/
$ dotnet run
C:\Program Files\dotnet\sdk\3.1.401\Xamarin\Android\Xamarin.Android.CSharp.targets(51,5): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.401\Xamarin\Android\Xamarin.Android.Common.targets" was not found. Confirm that the expression in the Import declaration "Xamarin.Android.Common.targets" is correct, and that the file exists on disk.
[C:\Users\ea\Desktop\android\MyGame\MyGame.csproj]
The build failed. Fix the build errors and run again.