取消
顯示結果 
搜尋替代 
您的意思是: 

Use a C# dll

已解決!
前往解決方案

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 積分
1 條訊息(共 8 條)
4,005 檢視

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 積分
2 條訊息(共 8 條)
4,002 檢視

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 積分
3 條訊息(共 8 條)
4,000 檢視

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 積分
4 條訊息(共 8 條)
3,997 檢視
解決方案
由主題作者所接受 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. 極度高興的表情

5 條訊息(共 8 條)
3,995 檢視

@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 積分
6 條訊息(共 8 條)
3,991 檢視

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 積分
7 條訊息(共 8 條)
3,977 檢視

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

0 積分
8 條訊息(共 8 條)
3,973 檢視