I have written a dll with the revit Api.
There a simple function doSomethingToAElement
I want to use this function on a element
I have written
import clr # OK
... clr.AddReference('C:\\Users\\user040\\Project\\myDll.dll')
And I have this problem
Exception : System.IO.FileLoadException: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
at System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent)
at System.Reflection.AssemblyName..ctor(String assemblyName)
at System.Reflection.Assembly.LoadWithPartialName(String partialName)
at IronPython.Runtime.ClrModule.LoadAssemblyByPartialName(String name)
at IronPython.Runtime.ClrModule.AddReference(CodeContext context, String name)
at IronPython.Runtime.ClrModule.AddReference(CodeContext context, Object[] references)
at Microsoft.Scripting.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
at Microsoft.Scripting.Hosting.ScriptSource.ExecuteAndWrap(ScriptScope scope, ObjectHandle& exception)
Though this dll has compiled and is used already used for revit addin.
Solved! Go to Solution.
Maybe this message is trying to tell you:
"The assembly you are attempting to load is referencing some other assembly and has trouble resolving that reference."
What assemblies does myDll.dll reference?
I replace AddReference with AddReferenceToFileAndPath. Now its working.
Thanks for you help
Can't find what you're looking for? Ask the community or share your knowledge.