LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error trying to select a .NET dll for an invoke node

Solved!
Go to solution

Hi, I am having an issue using a dll in labview. I have labview 2023 installed on two machines, both 2023Q3 64 bit, 23.3.1f1

 

I made a test vi on one machine (23.3.1f1) to control a camera, which used a dll supplied by the manufacturer and it works without issue. I then wanted to recreate some of the camera control inside an existing VI on the second machine. However whenever I select the dll on the second machine, I get the error "an error occurred trying to open the assembly". Both machines are runnning the same 64 bit labview, so it can't be an issue with the bitness of the dll. To complicate matters a bit, the VI I am modifying was originally made with labview 2018 64-bit.

 

However, It also seems to be a problem trying to run the manufactures example VI from within their example project on the second machine. Whenever I try to open it, I get asked to locate the appropriate dll (even though it is in the folder that the dialog box opens with), but then when I try to run the program it produces the error "LabVIEW: (Hex 0x56A) The specified .NET class is not available in LabVIEW." 

 

I was wondering if there was anything I could try to fix this, either with labview or windows settings

0 Kudos
Message 1 of 16
(1,918 Views)

Did you check on the 2nd machine to see if all the DLLs were unblocked?

 

Right click, properties, look for this:

 

Kyle97330_0-1706030013187.png

 

Message 2 of 16
(1,870 Views)

Check that the DLL is unblocked as suggested.

 

Also, make certain the appropriate .NET Framework Runtime is installed. Depending on which OS and which framework version is required, that isn't a given.

Message 3 of 16
(1,866 Views)

Hi Kyle,

 

Thanks for the reply. Unfortunately there is no security section on the properties dialog, and no tick-box to unblock, just a space under the Attributes section.

 

I think I must be doing something really stupid, as I am a labview novice and it was a while since I made the test VI that successfully used the dll, so I can't remember the exact steps I took to make it work, and so I just made a new project and new VI on the first machine, and tried just placing a property node and using the "select class" menu item to link it to the dll, and get the same error "An error occurred trying to load the assembly", even though the dll is working on that machine in a my test project pointing at the exact same dll file, and it works with the manufacturer's example project on this machine too. Are there some options I need to set individually in the project that could affect its ability to load the dll?

0 Kudos
Message 4 of 16
(1,849 Views)

Hi Jim, thanks for taking the time to reply to my question. I have checked the dot net version using the command line "dotnet --list-sdks", and both machines have almost the same version. The first machine on which the dll works has 8.0.100, and the second machine has 8.0.101.

 

I mentioned in my reply to the other poster, I tried just making a new project on the first machine with an empty VI, and just putting a property node in and selecting the dll I want to use through the "select class" menu item, but I now get the same error here "An error occurred trying to load the assembly", even though I can use the dll in my other project, and in the manufacturer's example project which are both running in the same instance of labview, is there some project settings that I am forgetting that can affect the ability of labview to load the dll? I am a bit of a labview novice, and not a particularly experienced programmer overall, so no mistake is too stupid for me to make!

0 Kudos
Message 5 of 16
(1,848 Views)

LabVIEW only supports the .Net Framework. If your .Net assembly is really a .Net Core compiled assembly, then it can not be used in LabVIEW. Your assembly has to be compatible with the .Net Framework 4, usually that is nowadays at least 4.7.2 or 4.8(.1).

Rolf Kalbermatter
My Blog
Message 6 of 16
(1,805 Views)

@TomDzSTFC wrote:

Hi Jim, thanks for taking the time to reply to my question. I have checked the dot net version using the command line "dotnet --list-sdks", and both machines have almost the same version. The first machine on which the dll works has 8.0.100, and the second machine has 8.0.101.

 

I mentioned in my reply to the other poster, I tried just making a new project on the first machine with an empty VI, and just putting a property node in and selecting the dll I want to use through the "select class" menu item, but I now get the same error here "An error occurred trying to load the assembly", even though I can use the dll in my other project, and in the manufacturer's example project which are both running in the same instance of labview, is there some project settings that I am forgetting that can affect the ability of labview to load the dll? I am a bit of a labview novice, and not a particularly experienced programmer overall, so no mistake is too stupid for me to make!


Actually, I think most of your issue is probably on the Microsoft side of things at the moment.

 

The dotnet command is outputting SDKs for the current cross platform incarnation of .NET. Up until version 3 this was referred to as .NET Core, but since version 5 is simply called .NET. It won't list older ".NET Framework" versions.

 

Version 4 of the "Core" lineage was skipped to avoid confusion with the last version of the Windows only framework, which is referred to as .NET Framework. Confusingly similar name aside, these are separate frameworks and are not cross compatible (outside of libraries using .NET Standard 2.0 as a target). LabVIEW currently only supports .NET Framework, which you can download the runtime for here: https://dotnet.microsoft.com/en-us/download/dotnet-framework. You need to ensure that a runtime version compatible with your DLL is installed.

 

Is this a custom DLL? Do you know which framework version it targets?

0 Kudos
Message 7 of 16
(1,798 Views)

@JimB. wrote:


Actually, I think most of your issue is probably on the Microsoft side of things at the moment.

 

The dotnet command is outputting SDKs for the current cross platform incarnation of .NET. Up until version 3 this was referred to as .NET Core, but since version 5 is simply called .NET. It won't list older ".NET Framework" versions.

 

Version 4 of the "Core" lineage was skipped to avoid confusion with the last version of the Windows only framework, which is referred to as .NET Framework. Confusingly similar name aside, these are separate frameworks and are not cross compatible (outside of libraries using .NET Standard 2.0 as a target). LabVIEW currently only supports .NET Framework, which you can download the runtime for here: https://dotnet.microsoft.com/en-us/download/dotnet-framework. You need to ensure that a runtime version compatible with your DLL is installed.

 

Is this a custom DLL? Do you know which framework version it targets?


Hi Jim,

 

It is a dll from a camera manufacturer. I used this method (https://stackoverflow.com/questions/3460982/determine-net-framework-version-for-dll) to get the .net version for the dll, and it came back as v4.0.30319 .

 

I'm still very confused as to why on machine 1 (the "working" machine) the dll is accessible through my first project, and through the manufacturer's example project, but when I make a new project and try to just select the library for a newly placed property node in an empty vi (thorugh the "select class" menu item, it is unable to load the dll even when the same instance of labview is happily loading the dll in one of the other projects (as in I have both all projects open, and two work and one doesn't work). I feel like, because all other factors are the same, this must be due to something I am doing wrong in the new project?

 

Thanks again!

 

Tom.

0 Kudos
Message 8 of 16
(1,738 Views)

@rolfk wrote:

LabVIEW only supports the .Net Framework. If your .Net assembly is really a .Net Core compiled assembly, then it can not be used in LabVIEW. Your assembly has to be compatible with the .Net Framework 4, usually that is nowadays at least 4.7.2 or 4.8(.1).


Hi Rolf,

 

Thanks for the reply. I checked the .net version of the dll using this method (https://stackoverflow.com/questions/3460982/determine-net-framework-version-for-dll) and it came back v4.0.30319. The confusing thing for me is that labview on machine 1 happily loads the dll when I run the vi in the manufacturer's example project, and in the project I first made to experiment with the camera for myself, but machine 2, ostensibly with the same version of labview, cannot load the dll - but obviously this could be just differences with some settings in windows. Even more confusingly, when I create a new project on machine 1, and create an empty vi and just place a property node down, labview is unable to load the dll when I try to select it through the "select class" menu option, even though I have the manufacturer's project, and my first project open in the same instance of labview and they quite happily load the dll.

 

Many thanks,

 

Tom.

0 Kudos
Message 9 of 16
(1,736 Views)

@TomDzSTFC wrote:


Hi Jim,

 

It is a dll from a camera manufacturer. I used this method (https://stackoverflow.com/questions/3460982/determine-net-framework-version-for-dll) to get the .net version for the dll, and it came back as v4.0.30319 .

 

I'm still very confused as to why on machine 1 (the "working" machine) the dll is accessible through my first project, and through the manufacturer's example project, but when I make a new project and try to just select the library for a newly placed property node in an empty vi (thorugh the "select class" menu item, it is unable to load the dll even when the same instance of labview is happily loading the dll in one of the other projects (as in I have both all projects open, and two work and one doesn't work). I feel like, because all other factors are the same, this must be due to something I am doing wrong in the new project?

 

Thanks again!

 

Tom.


These machines are running the same version of Windows, correct? Have you compared versions of .NET Framework (not .NET sdk that you previously mentioned) installed on these machines?

 

Open PowerShell and enter the following command:

Get-ItemPropertyValue -LiteralPath 'HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release

 

If you have the runtime installed then this should return a numeric value. If it is not the same on both computers then they have different versions installed.

 

If that value is less than 528040 on either computer then I'd recommend installing the 4.8 (or 4.8.1) runtime, which you can get from the link I provided previously.

0 Kudos
Message 10 of 16
(1,720 Views)