TheSwamp
Code Red => .NET => Topic started by: HD on October 12, 2006, 09:14:37 AM
-
Hello,
For starters, here's my operating environment. I have Windows 2000 (SP4), AutoCAD 2006, AutoCAD 2007, and Visual Studio 2005 loaded on my PC. Since I have AutoCAD 2007 installed and I am building applications for AutoCAD 2006, I uncommented <supportedRuntime version="v1.1.4322"/> in acad.exe.config
After building an AutoCAD 2006 assembly, I receive the following messages when I try to load it using the AutoCAD netload command.
Command: netload
Cannot load assembly. Error details: System.BadImageFormatException: The format
of the file 'Autodesk_StatusBar.dll' is invalid.
File name: "Autodesk_StatusBar.dll"
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase,
Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound,
Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean
stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence
securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
at loadmgd()
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Documents and Settings\uscis002\My
Documents\Visual Studio
2005\Projects\Training\Autodesk_StatusBar\bin\Debug\Autodesk_StatusBar.dll
LOG: Appbase = C:\Program Files\AUTOCA~1\
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Documents and
Settings/uscis002/My Documents/Visual Studio
2005/Projects/Training/Autodesk_StatusBar/bin/Debug/Autodesk_StatusBar.dll.
For what it's worth, I can build AutoCAD 2007 assemblies and netload them just fine.
Any ideas?
Thanks,
Nick
-
Hey Nick,
Going to take a stab in the dark, but you may have to have your project reference the 06 dll files of Acad. Not sure if that is the problem, but it might be. If you want I can try and compile it here and send you the dll?
-
Nick,
I was able to compile the one you sent me, but I had to comment this line
//using System.Collections.Generic;
I even was able to load it into Acad, and use it.
-
Nick,
Guess you will have to wait for one of the masters to show up then. I can't help anymore, sorry.
-
Just a guess, but have you set "Copy Local" to false in the reference properties of AcMgd.dll and AcDbMgd.dll?
If you compiled against the AutoCAD 2007 versions of these files with "Copy Local" set to true and then loaded your assembly into 2006, I can see how that might cause a problem.
-
I think your issue might be that to use the older framework you need to compile your assembly with the older SDK, I.E VS2003. I am pretty sure that VS2005 can only compile the latest framework 2.0. AutoCAD 2005 & 2006 can use the later framework 2.0 I have never needed to change this.
Dan
-
If you have .Net 2.0 on the CAD 2006 machines, just leave it at that and DO NOT uncomment the acad.exe.config.
I'm running 2006 and VS 2005 with no problems.
Cheers,
Glenn.
-
AutoCAD 2006 tells me "unknown command"
Did you change the 'Copy Local' property to false for AcMgd.dll and AcDbMgd.dll ??