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
已解決! 轉到解決方案。
在 08-18-2011 12:50 PM
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?
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...
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
在 08-18-2011 01:07 PM
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. ![]()
在 08-18-2011 01:10 PM
@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.
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
在 08-18-2011 04:24 PM
Actually, you can, at least with C++, by installing the component from the Windows Software Development Kit.