Hi forum,
I'm a newbie of ObjectARX programming and I'm trying to migrate from VBA to .NET.
I read a few tutorials for developing apps with ObjectARX for AutoCAD.
Now, I'm following a tutorial (here) but I'm having troubles when I load the dll app in AutoCAD.
I get the following message:
Command: netload
Cannot load assembly. Error details: System.BadImageFormatException: Could not
load file or assembly 'file:///C:\Users\Paolo\documents\visual studio
2010\Projects\0.Autocad-HelloWorld\0.Autocad-HelloWorld\bin\Release\0.Autocad-He
lloWorld.dll' or one of its dependencies. This assembly is built by a runtime
newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///C:\Users\Paolo\documents\visual studio
2010\Projects\0.Autocad-HelloWorld\0.Autocad-HelloWorld\bin\Release\0.Autocad-He
lloWorld.dll'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
at loadmgd()
AVV: la registrazione dell'associazione di assembly è disattivata.
Per attivare la registrazione degli errori di associazione di assembly,
impostare il valore del Registro di sistema
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) su 1.
Nota: alcune penalità di prestazione sono associate alla registrazione degli
errori di associazione di assembly.
Per disattivare la funzionalità, rimuovere il valore del Registro di sistema
[HKLM\Software\Microsoft\Fusion!EnableLog].
I want to program for AutoCAD 2011 32/64bits.
I attach a couple of pictures of my code and referenced dlls for this project.
All the AutoCAD dlls are from C:\ObjectARX 2011\inc-x64 folder, AcDbMgd and AcMgd dlls are from C:\ObjectARX 2011\inc folder.
Thanks in advance for your help.
P.
Solved! Go to Solution.
Solved by Alexander.Rivilis. Go to Solution.
Problem is due to:
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
What VS version you using? What .NET version target is selected?
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Hi Alexander,
I'm using VB.NET 2010 Express, targeting FrameWork 4.0 by default
I thought about targeting another FW, I tried 3.5 (My project-Compile-Advanced compile options) but even if the output on building the dll returns no errors, as soon as I load the dll in AutoCAD I get the prompt message I previously posted.
Thanks for your interest in my problem.
Regards,
Try to change acad.exe.config file such as:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Hi Alexander, hi forum.
I did find the solution..it seems that for building apps for Autocad2011 the tool needed is Visual Studio 2008 with SP1.
I downloaded the package and installed properly, recompiled the app and it actually works.
By the time I'm writing I see you just replied me.
I try your hint now.
thank you again and regards,
P
Thank you Alexander! It works great with your correction.
The code you provided was already there but it was commented in my acad.exe.config xml file.
I copied it and replaced and reloaded the app.
Now everything works fine.
Thanks again.
P.