इसके माध्यम से साझा किया गया


Build Targets

The following build targets are defined for Xamarin.Android projects.

Build

Builds the source code within a project and all dependencies.

This target does not create an Android package (.apk file). To create an Android package, use the SignAndroidPackage target, or set the `$(AndroidBuildApplicationPackage) property to True when building:

msbuild /p:AndroidBuildApplicationPackage=True App.sln

BuildAndStartAotProfiling

Builds the app with an embedded AOT profiler, sets the profiler TCP port to $(AndroidAotProfilerPort), and starts the default activity.

The default TCP port is 9999.

Added in Xamarin.Android 10.2.

Clean

Removes all files generated by the build process.

FinishAotProfiling

Must be called after the BuildAndStartAotProfiling target.

Collects the AOT profiler data from the device or emulator through the TCP port $(AndroidAotProfilerPort) and writes them to $(AndroidAotCustomProfilePath).

The default values for port and custom profile are 9999 and custom.aprof.

To pass additional options to aprofutil, set them in the $(AProfUtilExtraOptions) property.

This is equivalent to:

aprofutil $(AProfUtilExtraOptions) -s -v -f -p $(AndroidAotProfilerPort) -o "$(AndroidAotCustomProfilePath)"

Added in Xamarin.Android 10.2.

GetAndroidDependencies

Creates the @(AndroidDependency) item group, which is used by the InstallAndroidDependencies target to determine which Android SDK packages to install.

Install

Creates, signs, and installs the Android package onto the default device or virtual device.

The $(AdbTarget) property specifies the Android target device the Android package may be installed to or removed from.

# Install package onto emulator via -e
# Use `/Library/Frameworks/Mono.framework/Commands/msbuild` on OS X
MSBuild /t:Install ProjectName.csproj /p:AdbTarget=-e

InstallAndroidDependencies

Calls the GetAndroidDependencies target, then installs the Android SDK packages specified in the @(AndroidDependency) item group.

The $(AndroidManifestType) MSBuild property controls which Visual Studio SDK Manager repository is used for package name and package version detection, and URLs to download.

SignAndroidPackage

Creates and signs the Android package (.apk) file.

Use with /p:Configuration=Release to generate self-contained "Release" packages.

StartAndroidActivity

Starts the default activity on the device or the running emulator.

To start a different activity, set the $(AndroidLaunchActivity) property to the activity name.

This is equivalent to:

adb shell am start @PACKAGE_NAME@/$(AndroidLaunchActivity)

Added in Xamarin.Android 10.2.

StopAndroidPackage

Completely stops the application package on the device or the running emulator.

This is equivalent to:

adb shell am force-stop @PACKAGE_NAME@

Added in Xamarin.Android 10.2.

Uninstall

Uninstalls the Android package from the default device or virtual device.

The $(AdbTarget) property specifies the Android target device the Android package may be installed to or removed from.

UpdateAndroidResources

Updates the Resource.designer.cs file.

This target is usually called by the IDE when new resources are added to the project.