Call .NET DLL methods plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 32: Line 32:


Version 0.3 including source is available here <attach>CLR.zip</attach> as-is.
Version 0.3 including source is available here <attach>CLR.zip</attach> as-is.
== Prerequisites ==
The plugin will need the .NET 2.0 framework to be installed and the MS Visual C++ 2008 redist package. Both can be included in the installer or downloaded via the installer using for instance the inetc plugin.


== Version history ==
== Version history ==
Line 38: Line 42:
* 0.2 Changed to native NSIS plugin and some bugfixes
* 0.2 Changed to native NSIS plugin and some bugfixes
* 0.3 Bugfix: If more than one class was found in an assembly, only the first one could be loaded.
* 0.3 Bugfix: If more than one class was found in an assembly, only the first one could be loaded.
* 0.3 CLR.dll is now compiled in release mode, in order to work on systems without VS2008 installed. Various other minor bugfixes as well.


[[Category:Plugins]]
[[Category:Plugins]]

Revision as of 07:55, 9 September 2008

Author: claesabrandt (talk, contrib)


NSIS forum thread

Description

This is a NSIS plug-in, that can call methods in your managed .NET DLL.

Place the plugin in the NSIS plugins folder. You call your .NET DLL methods by calling CLR:Call. This expects the following parameters:

  • Assembly dll filename
  • Namespace and classname with dot in between
  • Method name
  • Number of parameters
  • Parameters

At the moment, the supported parameter types are string, char, int, float and boolean. Return value can be of those types too but are returned as strings to NSIS. Before calling the plug-in, call SetOutPath and copy the .NET DLL to be invoked.

Sample NSIS script calling a method in a .NET DLL, which takes five parameters: string, char, int, float and boolean and returns a string:

InitPluginsDir
SetOutPath $PLUGINSDIR
 
File "SomeAssembly.dll"
CLR::Call "SomeAssembly.dll" "SomeNamespace.SomeClass" \
  "SomeMethod" 5 "mystring1" "x" 10 15.8 false
 
pop $0  
MessageBox MB_OK $0

The plug-in is fully functional but still undergoes some development and changes.

Download

Version 0.3 including source is available here CLR.zip (35 KB) as-is.

Prerequisites

The plugin will need the .NET 2.0 framework to be installed and the MS Visual C++ 2008 redist package. Both can be included in the installer or downloaded via the installer using for instance the inetc plugin.

Version history

  • 0.1 Initial release of the plugin
  • 0.2 Changed to native NSIS plugin and some bugfixes
  • 0.3 Bugfix: If more than one class was found in an assembly, only the first one could be loaded.
  • 0.3 CLR.dll is now compiled in release mode, in order to work on systems without VS2008 installed. Various other minor bugfixes as well.