Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] Compatibility with existing projects (#556
) Existing projects may (will) have already set the `$(AndroidUseSharedRuntime)` and `$(EmbedAssembliesIntoApk)` "incorrectly" for an OSS xamarin-android install, as the OSS repo does not support "fast deployment" or the "shared runtime". Consequently, if an existing project has e.g. `$(AndroidUseSharedRuntime)`=True and/or `$(EmbedAssembliesIntoApk)`=False, there will be "weird" packaging-related errors, e.g.: jarsigner ... Scratch.App.apk jarsigner: unable to open jar file: .../Scratch.App.apk error MSB6006: "jarsigner.exe" exited with code 1. or > I managed to get a simple project building from command line, > it’s crashing on startup ...oops? Check for the existence of `$(MSBuildThisFileDirectory)Xamarin.Android.Common.Debugging.targets` to determine if we're operating in a "full"/"commercial" environment; if that file is not present, then override the `$(AndroidUseSharedRuntime)` and `$(EmbedAssembliesIntoApk)` properties so that things can reliably work. Additionally, provide a rudimentary `Install` target so that the [documented `Install` target works][0], which is additionally helpful as Visual Studio uses the `Install` target for deployment, so this might actually allow VS2017 to install using the resulting `.vsix`. The `Install` target merely invokes the `adb install` command; don't expect any meaningful/useful IDE feedback. Finally, the `$(FrameworkOverridePath)` must *always* be overridden on Windows within `Xamarin.Android.Sdk.props`, because by default it's set to `C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\`, which is *wrong*, resulting in errors such as: CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' and 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll'. Remove one of the duplicate references. `$(TargetFrameworkRootPath)` appears to be set properly by default in Visual Studio 2017, so that might not need to always override. [0]: https://developer.xamarin.com/guides/android/under_the_hood/build_process/#Build_Targets
- Loading branch information