将单元测试应用程序Nunit Lite Xamarin中的引用添加到Xamarin服务后,重建失败

时间:2018-08-17 16:01:12

标签: android xamarin nunit

我有要测试的android xamarin应用程序项目。 (Xamarin应用程序,绑定服务) 我已经创建了单元测试应用程序项目。(nunit lite)我添加了要在单元测试应用程序项目中通过Visual Studio测试的项目的引用。重建解决方案时,出现此错误。这是由于添加了此引用引起的。

Severity    Code    Description Project File    Line    Suppression State
Error       The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: 
Could not resolve reference to 'System.Void 
System.ServiceModel.ServiceBehaviorAttribute::.ctor()' (defined in 
assembly 'AndroidClientApi, Version=0.12.0.0, Culture=neutral, 
PublicKeyToken=c45bde296bb8c671') with scope 'System.ServiceModel, 
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
When the scope is different from the defining assembly, it usually 
means that the type is forwarded. ---> Mono.Cecil.ResolutionException: 
Failed to resolve System.Void 
System.ServiceModel.ServiceBehaviorAttribute::.ctor()
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference 
reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkCustomAttribute(CustomAttribute ca)
at 

Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider 
provider)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition 
assembly)
at Mono.Linker.Steps.MarkStep.Initialize()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
--- End of inner exception stack trace ---
at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
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()    Test            

有什么办法解决吗?

1 个答案:

答案 0 :(得分:0)

对我来说解决方案是:

NameOfTheProject->属性-> AndroidOptions->链接:无

enter image description here