The MITAB-1.7.0-WIN32.ZIP contains contrib\dotnet\MiApi.cs and MiWrapper.cs, use those. You can't use a native DLL directly in your .NET project, you must use the above wrappers.
Patrick On Tue, Jan 24, 2012 at 3:45 AM, keith_corlett <[email protected]> wrote: > ** > > > Hi folks, > > Briefly: I've just gotten mitab.dll to build using VS2010's command-line > tools (it won't build in the IDE), but I'm stuck with the same "reference > could not be added" error. > > First off, I tried downloading the precompiled win32 binaries > (MITAB-1.7.0-WIN32.ZIP) from mitab.maptools.org, but when I attempted to > add a reference the mitab.dll to my "C# Library" project (I intend to wrap > the DLL, leaving my main project in "safe mode") I get an error message box > saying: > > A reference to > "D:\DevEnvironments\QIF2MapInfo\MapInfoWrapper\lib\mitab-1.7.0-win32\mitab.dll" > could > not be added. Please make sure that file is accessible, and that is a valid > assembly or COM component. > > Google found this thread: > http://tech.groups.yahoo.com/group/mitab/message/1414 (from September > 2011) which indicates that mitab builds OK with 2010 command-line tools, so > I downloaded the source (mitab-1.7.0.zip) and followed the > build-instructions in README_VCPROJ.TXT and the formentioned thread. > > ASIDE: Interestingly my Visual Studio installation didn't have a shortcut > for a "Visual Studio x86 Command Prompt (2010)", so I made one by copying > the existing "Visual Studio Itanium Cross Tools Command Prompt (2010)" > shortcut and changing its target to "%comspec% /k ""D:\Program > Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86"... so now when I > start it I get the message "Setting environment for using Microsoft Visual > Studio 2010 x86 tools.", as desired for building mitab (I guess). > > Once I got the build environment setup, mitab.dll (and everything else) > built ok, but when I try to add a reference to my newly-built DLL from a C# > project (either a C# Library or C# Console project) I get the same > "reference could not be added." error (as above). > > My Environment: I'm developing in C-sharp using Visual Studio 2010 and > .NET 4.0 on XP-SP3 (32 bit), with MapInfo 10.5 (MIF Spec 1.5)... but I've > got access to VS2008 and VS2005 installers if required. Unfortunately my > existing Translator code-base IS .NET 4.0 dependent, but suppose I could > construct my MapInfoTabWriter.dll using an earlier version of Visual > Studio, and just reference that DLL from the existing .NET4 Translator > project; but I prefer to keep everything "together", if possible. > > Background: I'd like to use MiTab to write MapInfo tables directly from a > translation tool (called QIF2MapInfo) instead of writing MID/MIF files and > then importing them via a MapInfo.Application object. My expectation is > that writing directly to TAB-files will be a lot faster, and cleaner. I > really don't care how I get mitab working, so long as I get it working. > Note that the Translator "product" already works, writing TABs directory is > a nicety (my own initiative, mainly performance motivated, while I wait for > UAT) so nobody will cry if this ends-up in the too-hard basket. > > Please does anyone know why Visual studio would say "reference to > mitab.dll could not be added."? This error message is so damn generic that > it really doesn't give me anything to go on in the way of problem-solving > research. I guess that even a few keywords for what VS2010 requires in a > referenced-dll might help get me over the hump. > > Thanks in advance for your time. It is appreciated. > > Cheers. Keith. > > >
