[Closed] Error Importing DLL to Maxscript
hi, I know well mascript but only the essentials of C #. I wanted to understand how to import the DLL libraries in max to exploit their functionality.
I have Visual Studio 2010 and 3dstdio2011 (32 and 64).
I have followed the procedure done in this tutorial :
http://www.ehow.com/how_4575196_use-c-maxscript-dsmax.html
and i put this code in maxscript:
scriptpath=getdir #archives
Assembly = dotNetClass "System.Reflection.Assembly"
file = scriptpath + "/Maxscript Sandbox.dll"
if doesFileExist file then print "ok" else "no"
Assembly.loadfrom (file)
but this is the message error:
[b]-- Runtime error: dotNet runtime exception: Could not load file or assembly 'file:///C:\Users\****\Documents\3dsMax\archives\Maxscript Sandbox.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.[/b]
i put the file in attachment but i don’t understand where i wrong…
I read this:
http://area.autodesk.com/forum/autodesk-3ds-max/plugins—extensions/c-assembly-issue-this-assembly-is-built-by-a-runtime-newer-than-the-currently-loaded-runtime-and-cannot-be-loaded/
and i test:
dotnet.loadAssembly "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\system"
dotnet.loadAssembly "C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\system"
But now ? how i can change whis in Visual Studio 2010??
You are set up to compile for .NET 4.0 which isn’t supported in 3dsmax 2011 out of the box.
If you don’t need the latest framework then go back and set your VS2010 project up to target an earlier version of .NET.
That setting is located in the VS2010 project’s properties. On the Application panel it’s labelled ‘Target Framework’
If you really do need .NET 4.0 features in Max 2011 you will need to tweak your 3dsmax install.
Thankfully, James has got the required 4.0 patch all figured out and documented here http://forums.cgsociety.org/showthread.php?p=6661379
.biddle