After some research I have managed to create a C# assembly with one class that has one method. This method can be called directly from an InstallAware script. This method allows you to use unicode characters for all parameters and also allows you also to return values through the parameters back to the InstallAware script. In case any of you guys are interested in this I added all the things you need in the sample that is attached below.
There are two folders in this sample. Each for its own project.
The CSharpDLL folder is the C# solution which has only one class and only one method. This method is called TestMethod. It is exported with an Attribute like the C++ native methods. For this to work the project includes the NUget UnmanagedExports package which is referenced in the project references. Here is what the method looks like:
Code: Select all
[DllExport("TestMethod", CallingConvention = CallingConvention.StdCall)]
public static int TestMethod(string parameter1, string parameter2, IntPtr returnParameter1, IntPtr returnParameter2)
The first two parameters are only passed to the TestMethod, while the last two parameters also return a value back to the InstallAware script. The method also returns an integer.
The IASetup is the InstallAware project that calls the CSharpDLL.dll and its TestMethod. There is only one line that executes the call. The variables that are defined before are used to demonstrate that the method is capable of displaying regular and uni-code characters. The setup requires that the CSharpDLL.dll file is located in the same folder as the .mpr project file. Here is what the Call DLL command looks like:
Give it a try to see if it will work for you.
Regards, Damjan