views:

1223

answers:

1

I am attempting to use Scintilla .NET in a project (I want a good editor + syntax highlighting, etc). Unfortunately, when I reference the binaries in my project, I can't seem to actually use the Scintilla controls. I get two different errors.

  1. The first happens when adding SciLexer.dll as a reference to my project. I get a message that says: A reference to SciLexer.dll could not be added. Please make sure the file is accessible, and that it is a valid assembly or COM component.

  2. The second error occurs when I try to use the controls from ScintillaNET.dll. If I try to drag the component into a form, I get the following message: Failed to create component Scintilla. The error message follows: System.ComponentModel.Win32Exception: %1 is not a valid Win32 application at ScintillaNet.Scintilla.get_CreateParams()

Any help with either of these problems would be much appreciated. For the record, I am running Visual Studio 2008 running on a 64-bit Windows 7 platform.

Thanks.

+4  A: 

It's been a little while since I used Scintilla, but my understanding is that SciLexer.dll is an entirely native DLL, which is why you can't add a reference to it from Visual Studio.

Instead, you should 'arrange' for SciLexer.dll to appear in the right directory at runtime so that it can be loaded by ScintillaNET.dll. The safest way to do this would be to add SciLexer.dll to your Visual Studio project as a plain file (not as a reference), then change the properties on the file to have it copied to the output directory when your project is built.

Given that you're on 64-bit, I expect that you'll need to build your app specifically as 32-bit and not AnyCPU. As I say, it's been a while since I did this, but when I did, Scintilla only had 32-bit binaries.

Tim Robinson
Although the first part of your answer didn't directly solve my problem - it got me thinking that VS2008 probably couldn't find the reference, so I just added one directly to my Windows Path. Not sure how this will work out with respect to deploying the project (any suggestions would be appreciated), but at least that has been fixed. Accepting your answer.
JasCav
Good point - copying to the output directory solves the problem at run time, but that doesn't help Visual Studio. Maybe sticking it in the path was what I did in the end. :)
Tim Robinson