Failed to repack resources After adding google play game service - unity3d

I have added ConsoliAds plugin to my project and i can build android properly. But when I add Google Play Game plugin, during the build process I got Failed to re-package resources
There is an image before adding google play games
There is an image after adding google play game
During the build process I got Failed to re-package resources and these logs appear in the console.
I'm using the latest version of ConsoliAds and Google Play Game
CommandInvokationFailure: Failed to re-package resources. See the Console for details.
D:\ANDROID\AndroidSDK\build-tools\23.0.3\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "D:/ANDROID/AndroidSDK\platforms\android-23\android.jar" -F bin/resources.ap_ --extra-packages com.chartboost.sdk.unity:com.google.unity:com.heyzap:com.google.example.games.mainlibproj:com.google.android.gms.auth.api:com.google.android.gms.auth:com.google.android.gms.drive:com.google.android.gms.games:com.google.android.gms.nearby:com.Company.ProductName:android.support.compat:android.support.coreui:android.support.coreutils:android.support.fragment:android.support.mediacompat:android.support.v4:com.papata.btb:com.unity3d.ads -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-auth-11.0.4\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-auth-base-11.0.4\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-drive-11.0.4\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-games-11.0.4\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-nearby-11.0.4\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\support-compat-25.2.0\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\support-core-ui-25.2.0\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\support-core-utils-25.2.0\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\support-fragment-25.2.0\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\support-media-compat-25.2.0\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\support-v4-23.0.0\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\unity-android-resources\res" -S "E:\Hashtomin2\Temp\StagingArea\android-libraries\UnityAds\res"
stderr[
E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-auth-11.0.4\res\drawable-watch-v20\common_google_signin_btn_text_dark_normal.xml:9: error: Error: No resource found that matches the given name (at 'src' with value '#drawable/googleg_standard_color_18').
E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-auth-11.0.4\res\drawable-watch-v20\common_google_signin_btn_text_disabled.xml:16: error: Error: No resource found that matches the given name (at 'src' with value '#drawable/googleg_disabled_color_18').
E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-auth-11.0.4\res\drawable-watch-v20\common_google_signin_btn_text_light_normal.xml:9: error: Error: No resource found that matches the given name (at 'src' with value '#drawable/googleg_standard_color_18').
]
stdout[
Configurations:
(default)
Files:
AndroidManifest.xml
Src: () AndroidManifest.xml
Resource Dirs:
Including resources from package: D:\ANDROID\AndroidSDK\platforms\android-23\android.jar
applyFileOverlay for drawable
trying overlaySet Key=common_google_signin_btn_text_dark_normal.xml
trying overlaySet Key=common_google_signin_btn_text_disabled.xml
trying overlaySet Key=common_google_signin_btn_text_light_normal.xml
trying overlaySet Key=app_banner.png
trying overlaySet Key=app_icon.png
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res\drawable-xhdpi\app_banner.png
Processing image: res\drawable\app_icon.png
(processed image res\drawable\app_icon.png: 99% size of source)
Processing image: res\drawable-ldpi\app_icon.png
Processing image: res\drawable-hdpi\app_icon.png
(processed image res\drawable-ldpi\app_icon.png: 98% size of source)
Processing image: res\drawable-xhdpi\app_icon.png
(processed image res\drawable-hdpi\app_icon.png: 99% size of source)
Processing image: res\drawable-xxhdpi\app_icon.png
(processed image res\drawable-xhdpi\app_icon.png: 99% size of source)
Processing image: res\drawable-xxxhdpi\app_icon.png
(processed image res\drawable-xhdpi\app_banner.png: 93% size of source)
(processed image res\drawable-xxhdpi\app_icon.png: 99% size of source)
(processed image res\drawable-xxxhdpi\app_icon.png: 99% size of source)
(new resource id app_banner from xhdpi-v4\drawable\app_banner.png #generated)
(new resource id app_icon from drawable\app_icon.png #generated)
(new resource id app_icon from ldpi-v4\drawable\app_icon.png #generated)
(new resource id app_icon from hdpi-v4\drawable\app_icon.png #generated)
(new resource id app_icon from xhdpi-v4\drawable\app_icon.png #generated)
(new resource id app_icon from xxhdpi-v4\drawable\app_icon.png #generated)
(new resource id app_icon from xxxhdpi-v4\drawable\app_icon.png #generated)
(new resource id common_google_signin_btn_text_dark_normal from E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-auth-11.0.4\res\drawable-watch-v20\common_google_signin_btn_text_dark_normal.xml)
(new resource id common_google_signin_btn_text_disabled from E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-auth-11.0.4\res\drawable-watch-v20\common_google_signin_btn_text_disabled.xml)
(new resource id common_google_signin_btn_text_light_normal from E:\Hashtomin2\Temp\StagingArea\android-libraries\play-services-auth-11.0.4\res\drawable-watch-v20\common_google_signin_btn_text_light_normal.xml)
]
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.PostProcessAndroidPlayer.Exec (System.String command, System.String args, System.String workingdir, System.String[] progress_strings, Single progress_value, System.String errorMsg)
UnityEditor.Android.PostProcessAndroidPlayer.CompileResources (System.String stagingArea, System.String packageName, UnityEditor.Android.AndroidLibraries androidLibraries)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.HostView:OnGUI()
Updated: My Problem solved and I explained that here.

I tried everything in the internet nothing worked for me.
Here is what that I did to fix this issue.
Not much but don't get mad at me
Step 1: Export all asstets, resources ane everything except google services file. (If you are using multiple Google packages like me eg. Play service, ad seevice, IAP package don't export then). Export as unity package.
Step 2: create a new unity project
Step 3: First import all Google Play packages, don't import your package
Step 4: build and check that the is no error with the empty scene in your new project
Step 5: import your exported package from previous step
Step 6: fix errors in script file due to dependency in Google package
Step 7: build your project
Note: don't move your project to new location it may cause repacking issue again. I don't know why but this occurred to me

Related

I'm getting IL2CPP build error for some reason

For some reason, I'm getting build errors. I was be able to build my project clearly with mono. I'm trying to build the project with IL2CPP now and getting some errors.
I tried:
Changing Windows language to English. In fact, I reinstalled Windows 11.
And reinstall Unity, Visual Studio and sdk, ndk etc.
Btw, the error is about file path of compile.rsp file. I manually checked that file path and the file. it is exist in the right file location.
Here is the errors and console messages.
Error 1:
Internal build system error. BuildProgram exited with code -2147024893.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Program Files\Unity\Hub\Editor\2021.2.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Release\StaticLibs\armeabi-v7a\compile.rsp'.
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
at System.IO.File.InternalReadAllText(String path, Encoding encoding)
at System.IO.File.ReadAllText(String path)
at NiceIO.NPath.SystemIOFileSystem.File_ReadAllText(NPath path)
at NiceIO.NPath.WindowsFileSystem.File_ReadAllText(NPath path)
at Bee.Core.Stevedore.VirtualFileSystem.File_ReadAllText(NPath path)
at NiceIO.NPath.RelayingFileSystem.File_ReadAllText(NPath path)
at Bee.Core.BuildProgramFileSystem.File_ReadAllText(NPath path)
at NiceIO.NPath.ReadAllText()
at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupCompile(AndroidSharedLibraryConfiguration config, String name, AndroidTargetDeviceType deviceType, NPath sourceFilePath)
at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupLibUnityLibrary()+MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupPlayerBuild()
at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
at PlayerBuildProgramTypeWrapper.Run(String[] args)
at Program.Main(String[] args)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Error 2:
BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <374d68101b9e4829844c8329406f32cc>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
I finally solved my problem.
2 things you must be sure
Set your Windows Display Language to English
Change your Unity version from 2021.2 to 2020.3
These 2 thing most probably solve your problem like mine
In case the answer presented doesn't help, I've found a different possible cause of the error: large arrays of values (over 10k elements) can't be handled by IL2CPP specifically. No clue why-how, it just was mentioned on a thread in Unity forum, and it did solve the problem for me - I just dropped all the values in the text file and parsed it on startup.

How to fin Win32Exception Error when adding Facebook SDK to Unity?

After adding the Facebook SDK into Unity I am getting this error and the Android Build Facebook Settings arent showing a dropdown.
Win32Exception: ApplicationName='cmd', CommandLine='/Cecho "xxx" | openssl base64', CurrentDirectory='', Native error= The system cannot find the file specified.
System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at <3845a180c26b4889bc2d47593a665814>:0)
System.Diagnostics.Process.Start () (at <3845a180c26b4889bc2d47593a665814>:0)
(wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
Facebook.Unity.Editor.FacebookAndroidUtil.DoesCommandExist (System.String command) (at <1e648b4081db4625b06f95d668cd2dd4>:0)
Facebook.Unity.Editor.FacebookAndroidUtil.get_DebugKeyHash () (at <1e648b4081db4625b06f95d668cd2dd4>:0)
Facebook.Unity.Editor.FacebookAndroidUtil.get_SetupProperly () (at <1e648b4081db4625b06f95d668cd2dd4>:0)
Facebook.Unity.Editor.FacebookSettingsEditor.AndroidUtilGUI () (at <1e648b4081db4625b06f95d668cd2dd4>:0)
Facebook.Unity.Editor.FacebookSettingsEditor.OnInspectorGUI () (at <1e648b4081db4625b06f95d668cd2dd4>:0)
UnityEditor.InspectorWindow.DoOnInspectorGUI (System.Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, System.Boolean wasVisible, UnityEngine.Rect& contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
install openSSL https://www.openssl.org/
I Solved Adding in Enviroment variable "C:\Windows\System32" example:
Path = C:\Windows\System32;C:\Program Files\Java\jdk1.7.0_51\bin;C:\OpenSSL\bin
be sure to add them in the exact order
ref : "Facebook SDK "Edit Settings" errors in Unity for Android"

Playscape Publishing Kit. Failed to apply patch to the .jar file

Unable to build the project with Playscape Publishing Kit v1.11 on a Mac.
An error occured while applying post-build logic: failed to apply patch to the .jar file
log file https://www.dropbox.com/s/plz5aneqgbj4mf7/log_jar.txt?dl=0
Bugs for exceptions thrown have titles File:line from the top stack,
e.g., "SomeFile.java:243"
If you don't find the exception below in a bug, please add a new bug
at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.
org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to org.aspectj.weaver.ReferenceType
when weaving type com.startapp.android.publish.h.b$4
when weaving classes
when weaving
when batch building BuildConfig[null] #Files=0 AopXmls=#0
org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to org.aspectj.weaver.ReferenceType
java.lang.ClassCastException: org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to org.aspectj.weaver.ReferenceType
at org.aspectj.weaver.BoundedReferenceType.parameterize(BoundedReferenceType.java:113)
at org.aspectj.weaver.ResolvedType.parameterize(ResolvedType.java:2489)
at org.aspectj.weaver.ResolvedMemberImpl.parameterize(ResolvedMemberImpl.java:897)
at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:794)
at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:742)
at org.aspectj.weaver.ReferenceType.getDeclaredMethods(ReferenceType.java:859)
at org.aspectj.weaver.ResolvedType$MethodGetterIncludingItds.get(ResolvedType.java:252)
at org.aspectj.weaver.ResolvedType$MethodGetterIncludingItds.get(ResolvedType.java:250)
at org.aspectj.weaver.Iterators$4$1.hasNext(Iterators.java:213)
at org.aspectj.weaver.Iterators$4.hasNext(Iterators.java:230)
at org.aspectj.weaver.ResolvedType.lookupResolvedMember(ResolvedType.java:619)
at org.aspectj.weaver.JoinPointSignatureIterator.findSignaturesFromSupertypes(JoinPointSignatureIterator.java:192)
at org.aspectj.weaver.JoinPointSignatureIterator.hasNext(JoinPointSignatureIterator.java:68)
at org.aspectj.weaver.patterns.SignaturePattern.matches(SignaturePattern.java:317)
at org.aspectj.weaver.patterns.KindedPointcut.matchInternal(KindedPointcut.java:197)
at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137)
at org.aspectj.weaver.patterns.NotPointcut.matchInternal(NotPointcut.java:56)
at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137)
at org.aspectj.weaver.patterns.AndPointcut.matchInternal(AndPointcut.java:56)
at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137)
at org.aspectj.weaver.patterns.AndPointcut.matchInternal(AndPointcut.java:56)
at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137)
at org.aspectj.weaver.patterns.AndPointcut.matchInternal(AndPointcut.java:56)
at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:137)
at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:113)
at org.aspectj.weaver.Advice.match(Advice.java:109)
at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:152)
at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3304)
at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2692)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:480)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:100)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1689)
at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1633)
at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1398)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1184)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.weaveQueuedEntries(AjPipeliningCompilerAdapter.java:514)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.afterCompiling(AjPipeliningCompilerAdapter.java:375)
at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:78)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:421)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1036)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:272)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:185)
at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
at org.aspectj.tools.ajc.Main.run(Main.java:371)
at org.aspectj.tools.ajc.Main.runMain(Main.java:248)
at org.aspectj.tools.ajc.Main.main(Main.java:84)
5 fail|aborts
[PS-Warn] process failed with error
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogWarning(Object)
Playscape.Internal.L:W(String, Object[]) (at Assets/Plugins/Playscape/Internal/L.cs:43)
Playscape.Editor.UnityDebugLogger:W(String, Object[]) (at Assets/Plugins/Playscape/Editor/UnityDebugLogger.cs:38)
Playscape.Editor.AndroidApkCreator:runProcessWithCommand(String, String) (at Assets/Plugins/Playscape/Editor/AndroidApkCreator.cs:515)
Playscape.Editor.AndroidApkCreator:applyPatch(String, String, String) (at Assets/Plugins/Playscape/Editor/AndroidApkCreator.cs:387)
Playscape.Editor.BuildProcess:Build(String) (at Assets/Plugins/Playscape/Editor/BuildProcess.cs:198)
Playscape.Editor.AndroidPostProcessor:build(Boolean, BuildCompleted, BuildProgressChanged, BuildFailed) (at Assets/Plugins/Playscape/Editor/AndroidPostProcessor.cs:44)
Playscape.Editor.AndroidPostProcessor:Run() (at Assets/Plugins/Playscape/Editor/AndroidPostProcessor.cs:88)
Playscape.Editor.BuildProcessor:OnPostprocessBuild(BuildTarget, String) (at Assets/Plugins/Playscape/Editor/BuildProcessor.cs:41)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, BuildTarget, BuildOptions, Boolean, UInt32&)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean, BuildOptions, Boolean)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean, BuildOptions)
UnityEditor.BuildPlayerWindow:GUIBuildButtons(Boolean, Boolean, Boolean, BuildPlatform)
UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings()
UnityEditor.BuildPlayerWindow:OnGUI()
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object)
UnityEditor.HostView:Invoke(String)
UnityEditor.HostView:OnGUI()
Please, check that you've done the following:
You have required android api version or android 19 in android sdk folder
You have downloaded google-play-services inside android sdk folder

Running nunit-console on a solution file leads to System.IO.FileLoadException

When I try to use nunit-console.exe to run all the tests in a solution file as such:
nunit-console.exe MyProject.sln
I get the following exception (shown below). However when run the console runner on ANY of the projects in my folder structure, the runner works just fine and never gives me the following exception. I also am pretty certain that the version of the nunit library that I am linking to is the same as the runner that I am using. Also, my solution doesn't reference any projects that are outside the directory structure containing my .sln file.
Does anyone have any clue what I can do!? :(
Thanks!
Phil
NUnit version 2.5.10.11092
Copyright (C) 2002-2009 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
CLR Version: 4.0.30319.1 ( Net 4.0 )
ProcessModel: Default DomainUsage: Default
Execution Runtime: net-4.0
Unhandled Exception:
System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=2.5.10.11092, Culture=neutral, Pu
blicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the
assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77'
Server stack trace:
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount,
IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInsta
ntiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHa
ndle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethod
Arguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope
, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilte
rType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMeth
odInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken,
Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecorate
dTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly)
at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server,
Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExec
uteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Core.TestRunner.Load(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Try using the Fusion Log Viewer to see what assembly is failing to load. It should tell you not only what file it is failing on, but where it tried looking for that file.
In my case nunit-console.exe did not respect the assembly redirection from web|app.config. unless you provide /domain=multiple
My Problem:
EntityFrameworkTesting.Moq -> requests Moq, Version=4.2.1409.1722
I had already a newer assembly referenced.
The solution for me was to add /domain=multiple parameter. see the NUnit docs
So I run:
D:\tools\NUnit-2.6.4\bin\nunit-console.exe %SOLUTION_PATH%\Project.sln /config:Release /framework:net-4.0 /domain=multiple /xml=nunit-result.xml

Monotouch - Missing Method on DLL

I'm trying to create a project in .Net for IPhone using Monotouch. My problem is:
I have a DLL generated by Visual Studio 2010. This DLL just have an Interface and two other classes. I can use with no problems in my project in Visual Studio, but when I try to use the same one in Monotouch, i've got this error:
Building: HelloWorld (Debug|iPhoneSimulator)
Building Solution HelloWorld
Building: HelloWorld (Debug|iPhoneSimulator)
Performing main compilation...
Updating CodeBehind files
Updated MainWindow.xib.designer.cs
/Developer/MonoTouch/usr/bin/smcs /noconfig "/out:/Users/claudio/Documents/Development/DotNet/HelloWorld/HelloWorld/bin/iPhoneSimulator/Debug/HelloWorld.exe" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Runtime.Serialization.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.ServiceModel.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.ServiceModel.Web.dll" "/r:/Users/claudio/Documents/Development/DotNet/HelloWorld/HelloWorld/bin/Abcom.EmailService.ContractsCS.dll" /nologo /warn:4 /debug:+ /debug:full /optimize- /codepage:utf8 "/define:DEBUG" /t:exe "/Users/claudio/Documents/Development/DotNet/HelloWorld/HelloWorld/MainWindow.xib.designer.cs"
"/Users/claudio/Documents/Development/DotNet/HelloWorld/HelloWorld/Main.cs" "/Users/claudio/Documents/Development/DotNet/HelloWorld/HelloWorld/Class1.cs"
Missing method .ctor in assembly /Users/claudio/Documents/Development/DotNet/HelloWorld/HelloWorld/bin/Abcom.EmailService.ContractsCS.dll, type System.Runtime.Versioning.TargetFrameworkAttributeThe class System.Runtime.Versioning.TargetFrameworkAttribute could not be loaded, used in Abcom.EmailService.ContractsCSCan't find custom attr constructor image: /Users/claudio/Documents/Development/DotNet/HelloWorld/HelloWorld/bin/Abcom.EmailService.ContractsCS.dll mtoken: 0x0a000001
Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'Abcom.EmailService.ContractsCS'.
at (wrapper managed-to-native) System.Reflection.Assembly:InternalGetType (System.Reflection.Module,string,bool,bool)
at System.Reflection.Assembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) [0x00000] in :0
at System.Reflection.Assembly.GetType (System.String name) [0x00000] in :0
at Mono.CSharp.RootNamespace.GetTypeInAssembly (System.Reflection.Assembly assembly, System.String name) [0x00000] in :0
at Mono.CSharp.RootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in :0
at Mono.CSharp.GlobalRootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in :0
at Mono.CSharp.Namespace.LookupType (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in :0
at Mono.CSharp.Namespace.Lookup (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in :0
at Mono.CSharp.TypeManager.CoreLookupType (Mono.CSharp.CompilerContext ctx, System.String ns_name, System.String name, Kind type_kind, Boolean required) [0x00000] in :0
at Mono.CSharp.TypeManager.InitCoreTypes (Mono.CSharp.CompilerContext ctx) [0x00000] in :0
at Mono.CSharp.Driver.Compile () [0x00000] in :0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0
Build complete -- 1 error, 0 warnings
---------------------- Done ----------------------
Build: 1 error, 0 warnings
Somebody knows what's going on here?
Regards,
Claudio
Kevin is correct.
.NET has several "profiles" and the profiles are governed by their anchoring "mscorlib.dll". From the anchoring mscorlib.dll, all the rest of the assemblies flow. You will notice that you should not really mix an assembly compiled with a 2.0 mscorlib on a 4.0 system, or the other way around (they might work, but they are not guaranteed to work).
So in general, you need to compile your code using the same family of assemblies. When using the 4.0 mscorlib, you use the 4.0 family of assemblies; When using the 2.0, 3.5 and 3.5sp1, you use the 2.0 mscorlib; When you use Silverlight, you use the Silverlight 2.1 mscorlib set of APIs.
MonoTouch introduces its own anchoring mscorlib, versioned as 2.1.0.0 (the same one as Silverlight) and from this assembly, our API flows.
That is why you need to rebuild your libraries using Mono's assemblies for the 2.1.0.0 profile.
You can't link against DLLs compiled with Visual Studio. You have to recompile the DLL with Monotouch in order to use it.