Xamarin Android Build失败"outputAssembly的值无效"

Jer*_*enM 22 c# android xamarin.android xamarin xamarin.forms

几天前,我的解决方案似乎运行良好,但今天突然间Android项目无法构建.我没有得到错误,但我得到以下输出:

1>Build started.
1>Project "MyApp.Android.csproj" (Install target(s)):
1>Project "MyApp.csproj" (GetTargetFrameworks target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetFrameworks target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetPath target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetPath target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetNativeManifest target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetNativeManifest target(s)):
1>Done building project "MyApp.csproj".
1>"obj\Debug\MyApp.Android.dll;obj\Debug\MyApp.Android.dll" is an invalid value for the "OutputAssembly" parameter of the "Csc" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".
1>Done building project "MyApp.Android.csproj" -- FAILED.
1>Build FAILED.
Run Code Online (Sandbox Code Playgroud)

我还尝试删除bin en obj文件夹,清理并重建解决方案并删除MyApp.Android.dll.但在重建之后,同样的事情又发生了.

我收到以下警告:

Severity    Code    Description Project File    Line    Suppression State
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.   BarApp.Android      1   Active
Run Code Online (Sandbox Code Playgroud)

Har*_*iya 31

您必须设置项目Linking to Sdk Assemblies Only并将支持体系结构设置为armeabi - v7x86.

在尝试cleanrebuild项目之后

它像魅力一样工作.

  • 你能解释一下为什么吗?在将我的“可移植类库”迁移到“.net 标准”并将 .net 标准包更新到 2.0.2 后,这个问题发生在我身上。那些架构是什么? (2认同)

Uly*_*ves 5

如果您使用可移植类库 (PCL) 方法在 Android 和 iOS 之间组织代码,则可以通过右键单击它并在 Visual Studio 中选择菜单选项“卸载项目”来卸载 Android 项目。然后重新编译PCL项目,再次重新加载Android项目(右键->“重新加载项目”)并重新构建解决方案。这次它应该不会出错。现在尝试在 Android 模拟器上再次运行该应用程序。

您可能还必须重新启动模拟器并从模拟器/设备上卸载应用程序,然后才能再次成功运行它。