0

I am writing extension for AutoCad using Object ARX 2015 and .Net Framework. On my computer everything work good. But when i try to use my .dll on other computer. I get this error:

Exception Text

System.TypeLoadException: Could not load type 'System.Windows.Input.ICommand' from assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at Extension.MyCommands.KeelRibbon() at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
  • 1
    Are you sure the DLL is included in the output directory? – Yuval Itzchakov Apr 22 '15 at 12:26
  • You did not build this assembly properly. It was built on a machine that has .NET 4.5 installed, the project targets .NET 4.0 but used the wrong reference assemblies. It is essential that you use the ones in c:\program files (x86)\reference assemblies, not the ones in c:\windows\microsoft.net – Hans Passant Apr 22 '15 at 15:32
  • @HansPassant Is it possible for this error to occur even if the build output tells me it's using `C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll` That's in the folder you mentioned, but a user is getting the same TypeLoadException when trying to load ICommand from System.DLL. – user2023861 May 27 '15 at 13:27

2 Answers2

0

Since this class ist part of the .Net Framework it should be available on the computer if the correct .Net version is installed. I suggest one of the following solutions:

  • make sure that the .Net version for which you compiled your project is installed on the other computer
  • if that is not the case and you can't install the correct version on this computer compile your project for the available version (at least .Net 3.0)

Hope that helps

Romano Zumbé
  • 7,893
  • 4
  • 33
  • 55
0

For AutoCAD 2015, you need to set .NET 4.5 as target for your Visual Studio project.

Maxence
  • 12,868
  • 5
  • 57
  • 69