I have a build build script(MyBuild.sh) set up for creating the Android apk for a xamarin forms application.
My requirement is when i give the internal test builds i want the microsoft app center crashes and analytics in the the project csproj but when i take the PROD builds i don't want the microsoft app center crashes and analytics in the project
so in the build script i check whether its a PROD build and tried to remove the app center packages from the csproj.
if [ $Env == 'PROD' ]
then
dotnet remove ./Sample/Sample.csproj package Microsoft.AppCenter.Analytics
dotnet remove ./Droid/Sample.Droid.csproj package Microsoft.AppCenter.Crashes
fi
My problem is when the script is executed it correctly removes the package from the Shared Code but not from the Droid.csproj and while trying to remove the package it throws
info : Removing PackageReference for package 'Microsoft.AppCenter.Crashes' from project './Droid/Sample.Droid.csproj'.
error: The imported project "/usr/local/share/dotnet/sdk/2.1.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. /Users/george.thomas/Documents/Nov/Candidate/Droid/Sample.Droid.csproj
Now if i remove the MSBuildExtensionsPath from the Droid.csproj and run the script it correctly removes the packages but the project cant be built
throwning The target "Build" does not exist in the project
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />