Microsoft.SqlServer.Management.Smo.FailedOperationException (Could not load batchparser.dll)

0

I have C# project in which I am using Microsoft.SqlServer.Management.Smo, Microsoft.SqlServer.batchparser.dll and few other SqlServer dlls.

When I run the code on development box it works fine, but when I try running the executable on a clean machine (client's machine), it fails and throws this exception:

Microsoft.SqlServer.Management.Smo.FailedOperationException: ExecuteNonQuery failed for Database 'testdb'. ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.SqlServer.BatchParser.dll' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1) at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String query, ExecutionTypes executionType, Int32& statementsToReverse) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Smo.Database.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)

Now if I install "Microsoft SQL Server 2012 Shared Management Objects" on the client's machine it starts working.

I want to find out exactly what dependency is causing batchparser to fail. I grabbed the assemblies from the "Microsoft SQL Server 2012 Shared Management Objects" installer and copied them into GAC, but still the same error.

My questions are: 1 - How can I find the dependency of the batchparser.dll and append it to my installer? 2 - Is there a re distributable package for sql server 2012 that I can install before my application.

Thanks, Ali

c#
.net
sql-server
asked on Stack Overflow Jun 26, 2012 by Ali

1 Answer

0

For anyone having the same problem,

Installing Microsoft Visual C++ Redistributable Package ATL Security Update fixed the problem for me.

Cheers,

answered on Stack Overflow Jun 29, 2012 by Ali

User contributions licensed under CC BY-SA 3.0