Skip to content

Can't build Xamarin.Android project in VS 2019 with SignAndroidPackage as default MSBuild target #3715

@LDan1117

Description

@LDan1117

Steps to Reproduce

  1. Create a new Xamarin Android project in Visual Studio 2019 (v16.3.1 with Xamarin.Android.SDK 10.0.0.43 and Xamarin 16.0.3.274)
  2. Build in Release|AnyCPU. The build is successful.
  3. Edit the .csproj file and change the "DefaultTargets" to "SignAndroidPackage" instead of "Build".
  4. Build in Release|AnyCPU. The build fails with the following error:
The "LinkAssemblies" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'SignAndroidPackageErrorSample, Version=0.0.0.0, Culture=neutral, PublicKeyToken='.
Perhaps it doesn't exist in the Mono for Android profile?
File name: 'SignAndroidPackageErrorSample.dll'
   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Expected Behavior

The build must not fail. An .apk file must be created and signed.

Actual Behavior

The build fails.

Version Information

Microsoft Visual Studio Enterprise 2019
Version 16.3.1
VisualStudio.16.Release/16.3.1+29324.140
Microsoft .NET Framework
Version 4.8.03761

Installed Version: Enterprise

Visual C++ 2019 00435-60000-00000-AA987
Microsoft Visual C++ 2019

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Mono Debugging for Visual Studio 16.3.7 (9d260c5)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Snapshot Debugging Extension 1.0
Snapshot Debugging Visual Studio Extension Detailed Info

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.3.0.274 (d16-3@06531f8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.2.0.42 (5e8a208)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Log File

The sample project, screenshots, and logs are attached.
new android project
xamarin versions
default target
SignAndroidPackageError.log
SignAndroidPackageErrorSample.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions