LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading .NET 4.0 assembly

Solved!
Go to solution

Hi,

 

I'm trying to load a .NET 4.0 assembly in labview.

I read all the knowledge bases about this topic.

.NET 3.5 is not a problem, 4.0 is.

I tried adding the labVIEW.exe.config next to the labview exe to enable loading .NET 4.0 assemblies, but I still keep on receiving an error:

An error occurred trying to load the assembly.

 

Any ideas???

The .NET assembly is the simplest assembly there is just to test!

 

Thanks

Kim

0 Kudos
Message 1 of 16
(6,335 Views)

Kim,

 

what version of LV are you running?

 

It seems to be an issue not connected to LV. Look into this blog, it should answer your question.

 

hope it helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 16
(6,331 Views)

I tried it in LabVIEW2009 32 bit, LabVIEW2009 64 bit and LabVIEW2012 64 bit.

Thanks, I'll check the link right now.

0 Kudos
Message 3 of 16
(6,328 Views)

If I enable loadFromRemoteSources following error is displayed:

The selected file is not a .NET assembly, type library or automation execuatble.

 

0 Kudos
Message 4 of 16
(6,325 Views)

Kim,

 

are you sure that the assembly (DLL-extension?) is running properly at all? So does it work if being called by e.g. C#?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 16
(6,322 Views)

It's a simple dll made by a colleague in C#. To test if I can use more complicated dll's in the future.

He built different version. With framework 3.5 and 4.0.

The 3.5 can be loaded, the 4.0 returns errors.

0 Kudos
Message 6 of 16
(6,320 Views)

Maybe it makes sense to upload this assembly here. I expect it to not contain any confidential information....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 16
(6,318 Views)

He made 4 different assemblies, all give the same result

0 Kudos
Message 8 of 16
(6,315 Views)

THis is the (same) working 3.5 version

 

thanks for your help!

Message 9 of 16
(6,313 Views)
Solution
Accepted by topic author KimT

Kim,

 

using your attached LvTestLib40d.dll and LvTestLib40r.dll (running Win 7, 32bit), i managed to create and configure the constructor node without any error. Obviously, there is only one exported method called "DoeIets()". It returns the string "Dit is een .NET4 assembly." during runtime.

 

Here is my LabVIEW.exe.config content:

<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>
</configuration>

 

I hope you restarted LV completly after making changes to that file.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 10 of 16
(6,308 Views)