Unable to format C# code

CodeHighlighter for ASP.NET Forum

Posted 17 years ago by V.Pena
Avatar
Hello,

I am trying to use CodeHighlighter for ASP.NET (version v4.0.0042)in a .NET 2 website. I'm trying to format C# code, however I get the following error message:

Exception Details: ActiproSoftware.SyntaxEditor.InvalidLanguageDefinitionException: An error occurred while loading the DynamicSyntaxLanguage '{Unknown}':
The syntax language type 'CodeHighlighterTest.CSharpDynamicSyntaxLanguage, CodeHighlighterTest' could not be loaded.
The problem occurred near line 1, position 2
in Unknown Stream.

Here's my code: <pre>
<CH:CodeHighlighter ID="CodeHighlighter1" runat="server" LanguageKey="C#">
int test = 0;
int testing = 5;
</CH:CodeHighlighter></pre>

I've done the following:
1. Modified my web.config to include the entries for CodeHighlighter

2. Imported ActiproSoftware.CodeHighlighter.Net20.dll to my BIN folder

3. Imported all the Language files (along with the Lexers folder) to my website

4. Added <%@ Register TagPrefix="CH" Namespace="ActiproSoftware.CodeHighlighter" Assembly="ActiproSoftware.CodeHighlighter.Net20" %>
to my .aspx page

The strange thing is that if i set the LanguageKey to "XML", the code works and is formatted correctly. However, any other language, such as C# or CSS will not work.

I've tried changing the SyntaxLanguageTypeName attribute in ActiproSoftware.CSharp.xml to reflect my websites name: 'Experiments.CSharpDynamicSyntaxLanguage, Experiments' but this doesn't work either.

Any ideas how to fix this?

Thanks!

Comments (2)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Those SyntaxLanguage classes are used for outlining. You must include them in a Class Library assembly. I don't believe including them in a web site project will work. Then in your language XML definitions, you need to reference the class library assembly similar to what you tried for your main web site. After that it should work.

Alternatively remove the SyntaxLanguageTypeName attributes from the language XML definitions but a side effect will be the loss of outlining.


Actipro Software Support

Posted 17 years ago by V.Pena
Avatar
Thanks for the quick reply! Actually, I installed the CodeHighlighterTest.dll in my bin folder and the control now works correctly.
The latest build of this product (v4.0.59) was released 13 years ago, which was after the last post in this thread.