LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use a C# dll

Solved!
Go to solution

I created a simple dll in VS 2010 Express.  When I try to use it in LV 2010, I get a message when I try to configure using the constructor node that the dll is not a valid assembly.  I can use it in another C# application just fine.  Is there a trick to this?  I located the dll in the same directory as the project vi and it still didn't work.

 

TIA

Bill F

0 Kudos
Message 1 of 8
(3,079 Views)

What version of .NET is the assembly? If it's 4.0 then that's probably the issue. Make it into a 3.5 assembly or earlier.

 

Or

 

Did you compile it as a 64-bit assembly, and are trying to use 32-bit LabVIEW?

0 Kudos
Message 2 of 8
(3,076 Views)

Two good possibilities I had not thought about.  The computer is brand new, so yes it might be targeting 4.0.  Is that a setting in VS to make it use an earlire version.  Does LV 2011 support 4.0?

 

Also, yes the computer is running 64 windows, and the LV is not I suppose.  Is there a way around that, or do I need to find a 32 bit machine to compile it on?

 

Thanks,

Bill F

 

BTW Dude you answer a lot of questions.  NI should be paying you...

0 Kudos
Message 3 of 8
(3,074 Views)

A follow up.  When you say 32 bit LV, do you mean LV running on a 32 bit machine or a specific version of LV for 64 bit OSs?  LV 2010 is running on the same computer the dll was compiled on.

 

Bill F

0 Kudos
Message 4 of 8
(3,071 Views)
Solution
Accepted by topic author bfarley

You can configure the target .NET version from the project's properties. Right-click on the project in your solution and select "Properties". In the "Application" tab you can set the target framework.

 

As for the bitness, that's set via the solution. Right-click on the solution and select Configuration Manager. You'll see the list of projects in the solution and the platform being targeted. To target 32-bit specifically, select "x86" in the "Platform" column (make sure you select the appropriate configuration - Debug or Release). The Visual Studio Help has more details on how to use this dialog.

 


BTW Dude you answer a lot of questions.  NI should be paying you...


Not as much as Dennis should be paid. Smiley Very Happy

Message 5 of 8
(3,069 Views)

@bfarley wrote:

A follow up.  When you say 32 bit LV, do you mean LV running on a 32 bit machine or a specific version of LV for 64 bit OSs?  LV 2010 is running on the same computer the dll was compiled on.

 

Bill F


I'm referring to the LabVIEW version. A 32-bit app cannot directly call a 64-bit DLL. Thus, if you're running 64-bit Windows, but have 32-bit LabVIEW, and you compile a 64-bit DLL, then the 32-bit LabVIEW won't be able to call it.

0 Kudos
Message 6 of 8
(3,065 Views)

Targeting .net 3.5 fixed the issue.  64 bit wasn't an issue as it turns out because VS Express editions only produce 32 bit code anyway

 

Bill F

0 Kudos
Message 7 of 8
(3,051 Views)

Actually, you can, at least with C++, by installing the component from the Windows Software Development Kit.

0 Kudos
Message 8 of 8
(3,047 Views)