Can't find microsoft.sqlserver.batchparser.dll

Viewed 44190

I wrote an asp.net web app which uses SMO against SQL Server 2008 to be able to run some DB scripts. It references these assemblies (in the C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies folder):

Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Management.Sdk.Sfc
Microsoft.SqlServer.Smo

The microsoft.sqlserver.batchparser.dll is not in this folder. Locally (32 bits machine, IIS7) I have no issue.

When I publish the app to my hosting provider (discountasp.net, SQL Server 2008, IIS7, 32bits too), I get this error:

Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

I searched my local machine and I can't find this assembly. However it works well on this machine.

The "Microsoft SQL Server 2008 Setup Discovery Report" tool reports I have v10.1.2531.0 installed locally.

10 Answers

I resolve this only Just Right Click on Project navigate to Properties and Change Platform Target from 'Any' to 'x86'

failed to load microsoft.sqlserver.batchparser

 <startup useLegacyV2RuntimeActivationPolicy="true"> in App.config

This happened to me today. Running as administrator did the trick for me, I'm not sure why.

It's not ideal for production, but might work just fin for development environments.

Install the 'Microsoft Visual C++ 2013 Redistributable (x86)' if it is not showing up in add/remove programs.

Related