When trying to use `dotnet restore` on a Xamarin.Android project, it fails with the following error message:
C:\Users\dougl\Documents\Visual Studio 2017\Projects\App43\App43\App43.csproj(79,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.4\Xamarin\Android\Xamarin.Android.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Looking at the resolved $(MSBuildExtensionsPath) path which in this case is C:\Program Files\dotnet\sdk\1.0.4\Xamarin\Android\Xamarin.Android.CSharp.targets there does not exist such as file.
Rather the targets exist at the following resolved path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.CSharp.targets
I've also tried this with .NET Core 2.0 preview 2 bits and it seems to be the same behavior:
C:\Users\dougl\Documents\Visual Studio 2017\Projects\App43\App43\App43.csproj(79,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.0.0-preview2-006497\Xamarin\Android\Xamarin.Android.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
I believe this in theory would also happen in Xamarin.iOS as the targets will be missing.
.NET Core 2.0.0 Preview 2
Microsoft Visual Studio Enterprise 2017
Version 15.2 (26430.16) Release
Microsoft .NET Framework
Installed Version: Enterprise
Xamarin 22.214.171.1246 (fec6f88)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android SDK 126.96.36.199 (9dbc4c5)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 10.10.0.37 (ad35de4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
As a workaround, one would have to use msbuild via:
msbuild /t:restore MyApplication.sln
msbuild /t:restore MyApplication.csproj
However we all want to use that shiny new `dotnet restore` command!
It worked for me.