LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NET controller

Hi all,

 

I am getting an error message "Error occurred while generating .NET Controller code. Error in the application" after attempting to create a wrapper on my EIvision.dll.

 

I have used .NET Controller before and it worked on following DLLs:

  • system.drawing
  • mscorlib
  • various AForge DLL.

 

I have used the above DLLs in a project but they make the application file very large. I need to reduce the size by creating a customised EIvision DLL and make a wrapper on this DLL. EIvision will do NET call to above DLLs. This should make the application, much smaller.

 

I have tested EIvision and it worked fine when i do a NET calls on it.

 

I tried to do a wrapper on a different DLL from codeproject.com and get the same error message. It would be great if I know what the error was.

 

I use C# Express 2010 and LabWindows version 9.

 

Best Regards

Shane

 

0 Kudos
Message 1 of 4
(3,378 Views)

This is because your assembly (elvision.dll) is built with VS2010 and binds to .NET 4.0. CVI uses mixed-mode code to call .NET and this does not work with .NET 4.0 assemblies without some additional configuration. You can rebuild your assembly to bind to any older version of .NET (3.x, 2.x, 1.x) and it should work with CVI.

 

Or you can configure CVI to work around the .NET 4.0 mixed-mode incompatibility using the attached config file - cvi.exe.config. Place this file in the same folder as cvi.exe and then restart CVI. With this configuration, you should be able to generate wrappers for your assembly. Note that you need a similar configration file for your CVI-built program to call .NET 4.0 assemblies - that is, if your program is test.exe, rename cvi.exe.config as test.exe.config and place it next to test.exe. The important configuration items are:

1) useLegacyV2RuntimeActivationPolicy="true" - this fixes the incompatibility of .NET 4.0 assemblies with older mixed-mode code.

2) supportedRuntime version="v4.0"  - this explicitly states that the application can use .NET 4.0

Message 2 of 4
(3,363 Views)

many thanks for the quick reply. I opted for the second option and now i am able to generate wrapper for EIvision. I haven't tried the second part yet as I have to do the coding to use the wrapper.

 

Is it correct that with this configuration I should still be able to build the wrapper for NET3 dlls.

 

Thanks again. It is much appreciated.

Shane

0 Kudos
Message 3 of 4
(3,356 Views)

Yes, with this configuration you should still be able to build wrappers for .NET DLLs targeting older versions of the .NET framework.

0 Kudos
Message 4 of 4
(3,350 Views)