LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problems loading .NET assemblies

Solved!
Go to solution

Hello eveyone,

 

I got a dll(C#) form a instrument vendor and I want to use this assembly file to build a automation measurement program.

 

However, I encounter a issue that I can't load this dll correctly, It showed "An error occured trying to load the assembly"

 

I had tryied this steps in belowed pages, but no luck.

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YIQoCAO&l=zh-TW

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P8XnSAK&l=zh-TW

 

The assembly file is attached.

 

Please help me. Thank you.

 

螢幕擷取畫面 2024-11-07 162531.png

0 Kudos
Message 1 of 6
(97 Views)
Solution
Accepted by topic author wayneshen3113

You assembly was targeted exclusively for x86, but you are in x64 environment: (and by the way for .NET Frameworks 2.0).

Screenshot 2024-11-07 10.56.34.png

I recompiled it for AnyCPU using .NET Framework 4.8.1. Also added "Test" method. Version increased to 1.0.0.1, now should work:

Screenshot 2024-11-07 10.58.48.png

Try this one from the attachment.

 

0 Kudos
Message 2 of 6
(79 Views)

It didn't load for me in LabVIEW 2020 SP1 32-bit. And JetBrains dotPeek claimed it was linking to MS .Net 4.0.0 but I did not investigate beyond that.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 6
(61 Views)

Hi Andrey,

 

wow!  It is working now.

 

Thank you~~~~ 

0 Kudos
Message 4 of 6
(27 Views)

Hi rolfk,

 

Thank you for willing to repond my problems.

0 Kudos
Message 5 of 6
(25 Views)

@rolfk wrote:

It didn't load for me in LabVIEW 2020 SP1 32-bit. And JetBrains dotPeek claimed it was linking to MS .Net 4.0.0 but I did not investigate beyond that.


Yes, this is "legacy" assembly, in order to get this running you might need to place LabVIEW.exe.config next to LabVIEW.exe with content something like this:

<?xml version ="1.0" encoding="utf-8" ?>
<configuration>
   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0"/>
   </startup>
</configuration> 

Refer to

Loading .NET 2.0, 3.0 and 3.5 Assemblies in LabVIEW

as well as <startup>-Element and <supportedRuntime> element.

But rather than dealing with legacy stuff in this particular case was more simple to rebuild with latest sdk (at least for me).

 

@wayneshen3113 wrote:

Hi Andrey,

 

wow!  It is working now.

 

Thank you~~~~ 


Glad to see that this working now.

0 Kudos
Message 6 of 6
(5 Views)