41

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.

JasCav
  • 34,458
  • 20
  • 113
  • 170
  • 8
    Would you consider checking out alternatives? I really like the ICSharp.TextEditor which is part of SharpDevelop, a free IDE for .NET development. The editor is quite powerful, fully C# code, works like a charm on 32- and 64-bit systems - "it just works". Get it here http://www.icsharpcode.net/OpenSource/SD/Default.aspx and grab the ICSharpCode.TextEditor sub-project from within the large solution – marc_s Mar 06 '10 at 22:09

5 Answers5

28

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.

Community
  • 1
  • 1
Tim Robinson
  • 53,480
  • 10
  • 121
  • 138
  • 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 Mar 06 '10 at 23:56
  • For Visual Studio setup projects, you will also have to add the "File" to the output as the project output component will not pull in SciLexer.dll with just the client project copying to output folder. – Shiv Apr 06 '15 at 22:52
3

I got round the issue by copying the files to C:\Windows\SysWOW64

Got the idea from @weston's post.

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
Steve
  • 39
  • 2
  • 1
    Generally speaking, this may not be an option for client installs (best security practices, having multiple installations on the same machine - you can't have two different versions installed using this strategy for example). – Shiv Apr 06 '15 at 22:50
  • Copying the `SciLexer.dll` and `SciLLexer64.dll` to on of the folders specified by `PATH` solved the issue for me. VS 2019 was able to load the designer when doing so. – Pierre Arnaud Apr 29 '20 at 02:29
2

I use ScintillaNET (C# port). It is easy to use, but it is a memory hog.

https://github.com/jacobslusser/ScintillaNET

Dan Gifford
  • 886
  • 1
  • 9
  • 33
  • This is for anyone reading your post Dan. If you (they) have trouble auto-scrolling the ScintillaNET editor control, see this post: http://stackoverflow.com/questions/2898722/how-make-autoscroll-in-scintilla/33172398#33172398 – Robert Oschler Oct 16 '15 at 14:05
0

enter image description here

Click on RUN and select MyComputer Right click on MyComputer Go to Properties then Click on Advanced System Settings .

After that select Advanced and Click on Environment Variables.

Here we can add the value and path.

Value : what ever you like " Eg : Scintilla

Value path : where the downloaded dll kept ." EG: D:\prathap\DLL\

Download Path :https://scintillanet.codeplex.com/releases

Select the downloads from right hand side on the screen.

Then in the application add the Scintill Dll as a reference and other 2 dll as existing files.

Right click on project ADD -- Addexisting files -- then select the files from local system and make sure that you keep the 2 files "Copy to Output directory = Copy Always.

Then run the application it will work.

Draken
  • 3,134
  • 13
  • 34
  • 54
-1

i added reference to Scintilla.dll instead of SciLexer.dll - and it worked

  • I think you have some tool installed that itself added to the path variable and contains a SciLexer.dll (e.g. TortoiseSVN). In that case the dll from this location will be picked and your tool won't work on a clean installed machine. To check this open a command prompt and enter `where SciLexer.dll`. If you find something rename that file temporally and start your tool again. Last but not least run `ProcessMonitor` and check from where your SciLexer.dll will be loaded. – Oliver Jan 13 '14 at 07:12