I am using VB.net 2008 and .net 2.0 framework. After I modified a class library in development environment, I build a particular class library in visual studio 2008 and dll file get generated in the bin directory.

I copied this dll file to the bin directory in production environment. But I got the following error. The .net framework in production is running ver 2.0. Please help. Thanks a lot.

Server Error in '/alp/m' Application.
________________________________________
The format of the file 'Classlibrary' is invalid.
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.BadImageFormatException: The format of the file 'Classlibrary' is invalid.

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 'Classlibrary' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = Classlibrary, Version=1.0.3069.18998, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///c:/webapp/alp/m
LOG: Initial PrivatePath = bin

Calling assembly : EM.main, Version=1.0.3069.19003, Culture=neutral, PublicKeyToken=null.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Classlibrary, Version=1.0.3069.18998, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/alp_mchd/69165f10/4d09ca79/Classlibrary.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/alp_mchd/69165f10/4d09ca79/Classlibrary/Classlibrary.DLL.
LOG: Attempting download of new URL file:///c:/webapp/alp/m/bin/Classlibrary.DLL.

Stack Trace:

[BadImageFormatException: The format of the file 'Classlibrary' is invalid.]
EM.main.Web.Common.WebPageBaseClass.Page_Load(Object sender, EventArgs e) +0
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Recommended Answers

All 3 Replies

If your original code was referencing .net1.1 then you try and load it as .net2.0 these sorts of thing can happen. You should start a new project then copy the code over and fix it from there.

As you mentioned, I got it resolved due to different .net framework version. Thanks.

Glad it's resolved. Please remember to mark this solved. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.