Answered by:
VS2008 to VS2010: Could not load file or assembly 'Microsoft.SqlServer.BatchParser' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Question
-
User-1341056535 posted
I have a issue to upgrade a web project from VS2008 to VS2010.
The deployed VS2008 appl. is up and running since 2009...
I succesfully converted the project and everything works fine on my development computer.
The trouble begins after I deployed the project on the target server (the same server which runs the same project compiled with VS2008)
- Windows Server 2008r2 64bits
- SQL-Server R2
- IIS: Version Information: Microsoft .NET Framework Version:2.0.50727.5477; ASP.NET Version:2.0.50727.5479
In order to minimize the changes, I did not yet change the target framework to .NET 4 for any projects / libraries.
When starting the deployed application on the target server, I get the following message:
Could not load file or assembly 'Microsoft.SqlServer.BatchParser' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I already ensured "SharedManagementObjects_amd64.msi" has been installed; anyway the correct BatchParser DLL must have there before, since the web-appl compiled with VS2008 is running okay for 5 years on the same computer! I don't see how VS2010 can screw it up...
I also enabled the Assembly Load Trace:
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\DefaultAppPool
LOG: DisplayName = Microsoft.SqlServer.BatchParser
(Partial)
LOG: Appbase = file:///C:/webapp/order/
LOG: Initial PrivatePath = C:\webapp\order\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\webapp\order\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\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/Framework64/v2.0.50727/Temporary ASP.NET Files/order/35d7d198/88f82bf2/Microsoft.SqlServer.BatchParser.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/order/35d7d198/88f82bf2/Microsoft.SqlServer.BatchParser/Microsoft.SqlServer.BatchParser.DLL.
LOG: Attempting download of new URL file:///C:/webapp/order/bin/Microsoft.SqlServer.BatchParser.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
The correct BatchParser DLL is in my web appl "bin" directory! Its version is also the same on my dev computer (2005.90.5000.0 - date modified: 14/01/2013 8:21 AM - 351 KB)
It looks like a stupid configuration issue... but I'm really stuck.
Any suggestion?
Thursday, March 6, 2014 1:40 PM
Answers
-
User-1341056535 posted
I finally made the application work with some cleanup (explained below), but I still don't understand why this cleanup wasn't necessary when compiled from VS2008 and not with VS2010 involving exactly the same code / libraries / dll /......
The fix explained (I mean the coward "escape" to avoid the problem):
- I moved out the unecessary code that was requiring me to reference that library,
- Recompile everything
- Emptied the bin directory on server side
- Copied over (deployed) web appl
To me this does not explain the problem, therefore I leave this thread unanswered...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, March 6, 2014 3:32 PM
All replies
-
User-1341056535 posted
I finally made the application work with some cleanup (explained below), but I still don't understand why this cleanup wasn't necessary when compiled from VS2008 and not with VS2010 involving exactly the same code / libraries / dll /......
The fix explained (I mean the coward "escape" to avoid the problem):
- I moved out the unecessary code that was requiring me to reference that library,
- Recompile everything
- Emptied the bin directory on server side
- Copied over (deployed) web appl
To me this does not explain the problem, therefore I leave this thread unanswered...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, March 6, 2014 3:32 PM -
User-1454326058 posted
Hi ctheriault,
In my opinion, some old compiled files are not compatible for the VS2010. So, you should clean and recompile it.
There is a link may benefit you:
# What's New in Visual Studio 2010
http://msdn.microsoft.com/en-us/library/bb386063(v=vs.100).aspx
Thanks
Best Regards
Friday, March 7, 2014 4:48 AM