I had a C# Windows Forms application, built with Visual Studio 2008, that works fine using FrontPanel 4.0.8. I have the “using” directive, a project reference to the libFrontPanel-csharp DLL, and the libFrontPanel-pinv DLL is in the executable directory (Debug/bin).
However, after installing 4.2.5 and replacing the reference with one to the new DLL, the project no longer builds. I get an error message:
"The type or namespace name ‘com’ could not be found … "
The error is in the “using” line and the “com” is underlined in red. Nothing changed except for adding the new DLL as a reference.
Windows 7 Professional, 64-bit. Thanks for any help.
This is from the release notes for 4.2.4:
* Change C# API namespace to OpalKelly.FrontPanel to align with Microsoft standards.
The C# API was originally crafted in a namespace similar to how Java does things. We decided to take the leap and make this change in the C# API with this version. Sorry for the inconvenience, but this is the right way forward with the C# API.
Please also note that the C# API is not a complete API compared to the C++ one at the moment. In particular, the new DeviceInfo, ResetProfiles, and Register APIs are due for some modification in the near future.
Thanks – I was initially trying to build my own project and then reverted to seeing if I could build one of the samples. Apparently the sample projects in 4.2.5 have themselves not been updated to reflect the changes. Right now I’m trying to build the C# DESTester project; after changing “using com.opalkelly.frontpanel” in DESTester.cs to “using OpalKelly.FrontPanel” the build got a bit further, but then I got several other errors:
Error 1 ‘OpalKelly.FrontPanel.okTDeviceInfo’ does not contain a definition for ‘nDeviceMajorVersion’ and no extension method ‘nDeviceMajorVersion’ accepting a first argument of type ‘OpalKelly.FrontPanel.okTDeviceInfo’ could be found (are you missing a using directive or an assembly reference?)
and a bunch of similar errors.
I naively assumed that a C# project within the 4.2.5 distribution would build “as-is”, but I guess I have some digging to do.
Followup: I looked up the class definition of okTDeviceInfo and made a couple of edits to DESTester.cs (nDeviceMajorVersion became deviceMajorVersion and so on) and the program built successfully. All this was with VS 2012.