Could not load file or assembly

CodeHighlighter for ASP.NET Forum

Posted 18 years ago by Tom Ottman
Avatar
I am getting an error (enclosed below) in ASP.Net 2.0 when I enter this into the web.config:

<language key="VB.NET" definitionPath="~/Languages/ActiproSoftware.VBDotNet.xml" semanticParserType="VBSamples2.SemanticVBDotNetParser, VBSamples2"/>

Now if I set it to this:

<language key="VB.NET" definitionPath="~/Languages/ActiproSoftware.VBDotNet.xml"/>

Is works, but I do not get any of the +/- tree collapsing that I would like.

Any ideas?

Thanks,

Tom



Server Error in '/ITSamples/VBSamples2' Application.
--------------------------------------------------------------------------------

Could not load file or assembly 'VBSamples2' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'VBSamples2' or one of its dependencies. The system cannot find the file specified.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'VBSamples2' could not be loaded.


=== Pre-bind state information ===
LOG: User = INTEGRA\tottman
LOG: DisplayName = VBSamples2
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/ITSamples/VBSamples2/
LOG: Initial PrivatePath = c:\inetpub\wwwroot\ITSamples\VBSamples2\bin
Calling assembly : ActiproSoftware.CodeHighlighter, Version=3.1.17.0, Culture=neutral, PublicKeyToken=247639e84cc1f4e4.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\inetpub\wwwroot\ITSamples\VBSamples2\web.config
LOG: Using host configuration file: c:\windows\microsoft.net\framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/itsamples_vbsamples2/4edfdddb/c4bad6bf/VBSamples2.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/itsamples_vbsamples2/4edfdddb/c4bad6bf/VBSamples2/VBSamples2.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/ITSamples/VBSamples2/bin/VBSamples2.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/ITSamples/VBSamples2/bin/VBSamples2/VBSamples2.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/itsamples_vbsamples2/4edfdddb/c4bad6bf/VBSamples2.EXE.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/itsamples_vbsamples2/4edfdddb/c4bad6bf/VBSamples2/VBSamples2.EXE.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/ITSamples/VBSamples2/bin/VBSamples2.EXE.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/ITSamples/VBSamples2/bin/VBSamples2/VBSamples2.EXE.



Stack Trace:


[FileNotFoundException: Could not load file or assembly 'VBSamples2' or one of its dependencies. The system cannot find the file specified.]
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) +41
System.Activator.CreateInstance(String assemblyName, String typeName) +39
ActiproSoftware.CodeHighlighter.CodeHighlighter.GetLanguage(CodeHighlighterConfiguration config, String languageKey) +492
ActiproSoftware.CodeHighlighter.CodeHighlighter.ᐁ() +376
ActiproSoftware.CodeHighlighter.CodeHighlighter.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +59
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +68
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +37
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1896




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It looks like your line in the web.config is correct. We also use ASP.NET 2.0 and do the same thing for our site. All we do is place our library assembly (yours apparently is VBSamples2) into the web site's bin folder and it finds it ok.


Actipro Software Support

Posted 18 years ago by Robert Hogan
Avatar
I was having a similar problem. It has to do with the way the VS2005 solution converter re-arranges the files in the web project, and adds an "App_Code" folder and assembly. This relates to many problems that developers are having with reflection when converting from VS2003 to VS2005.

The problem reported in the previous post is that the assembly VBSamples2 can't be found--maybe because it was moved to the App_Code folder and the assembly is now non-dererministically named App_Code... with some hash code appended. This is solved by simply giving the partial name of the assembly, i.e. "<language..., App_Code"/> instead of <languge..., VBSamples2"/>.

This technique worked for me anyway. Alternatively, you can move your parser to a "helper" project where you can control the assembly name, and use that assembly name instead.

:-)
The latest build of this product (v4.0.59) was released 13 years ago, which was after the last post in this thread.