11-07-2024 02:32 AM
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.
Solved! Go to Solution.
11-07-2024 04:11 AM - edited 11-07-2024 04:16 AM
You assembly was targeted exclusively for x86, but you are in x64 environment: (and by the way for .NET Frameworks 2.0).
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:
Try this one from the attachment.
11-07-2024 05:51 AM - edited 11-07-2024 05:52 AM
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.
11-07-2024 09:16 PM
Hi Andrey,
wow! It is working now.
Thank you~~~~
11-07-2024 09:17 PM
Hi rolfk,
Thank you for willing to repond my problems.
11-08-2024 01:32 AM
@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.