Xamarin.Android.CSharp.targets" was not found

Viewed 33

I'm using AWS EC2- Mac. and using .Net Core without Visual Studio.

Getting error as in the below, could anyone suggest to sort out this

Error MSB4019: The imported project "/opt/VSSDK/sdk/6.0.303/Xamarin/Android/Xamarin.Android.CSharp.targets" was not found. Confirm that the expression in the Import declaration

1 Answers

First please make sure the path of the project doesn't special characters(e.g. %). Then try to delete the bin folders and the obj folders and rebuild it. If it doesn’t work, try to restart the VS.

If it still doesn’t work, you can try to follow the steps below:

1.Remove packages folder (it will be near by or one step up to your current project folder).

2.Restart the project or solution.

3.Rebuild solution file.

Then project will get new references from NuGet package manager.

Update:

how to update Nuget in command line

To update a NuGet package from the command line, use the same syntax as when installing new packages: dotnet add package. To update a package you will need to include the version switch.

For example:

  dotnet add package Spectre.Console --version 0.41.0

Actually, a fast way to update a NuGet package is through manual editing of the csproj file. This has been made possible after introducing the new and improved project format as part of .NET Core. To update a package, double click the project inside Visual Studio or open the csproj file in your favorite editor. Locate the PackageReference element of the NuGet package you are trying to update and input the new version.

For example:

  <ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="4.2.0.848062" />
    <PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
  </ItemGroup>
Related