【发布时间】:2019-09-24 04:19:06
【问题描述】:
我使用 Visual Studio 2019 完成了我的第一个应用程序 - 跨平台 Xamarin C#。该应用程序运行良好。现在,我想把它编译成apk文件,以便我可以手动安装到手机上。 我确实将调试更改为发布,然后从 android 文件中右键单击并选择存档。 但是,出现如下错误:
The preprocessor token 'rootnamespace' has been given more than one value. Choosing 'Calculator.Droid' as the value.
The preprocessor token 'assemblyname' has been given more than one value. Choosing 'Calculator.Android' as the value.
The preprocessor token 'fullpath' has been given more than one value. Choosing 'D:\Calculator\Calculator\Calculator.Android' as the value.
The preprocessor token 'outputfilename' has been given more than one value. Choosing 'Calculator.Android.dll' as the value.
The preprocessor token 'filename' has been given more than one value. Choosing 'Calculator.Android.csproj' as the value.
MSB4094: "obj\Release\81\Calculator.Android.dll;obj\Release\81\Calculator.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".
【问题讨论】:
-
您的
.csproj中是否有多个条目用于根命名空间、程序集名称等...? -
我怎么知道有多个条目?成功运行我的程序后,我没有碰任何东西。之后,我只是更改为发布并单击存档。
-
如果改成release模式,android默认链接器设置为
SDK Assemblies Only,可以参考这个链接docs.microsoft.com/en-us/xamarin/android/deploy-test/… -
嗨,我解决了这个问题,它是有效的,我得到了 apk。 :D。无论如何,我将链接更改为无,它是有效的。
-
@LeonLu 嗨,它不起作用。我将链接更改为无,它的工作原理。
标签: xamarin compilation apk release