I have this crazy issue where a SMO operation is failing, and the only difference is this odd file in my bin folder:
Could not load file or assembly 'Microsoft.SqlServer.BatchParserClien.dll
NOTE: That is not a typo, that is the actual name of the file in the file system.
I don't know what to make of this, I have never seen anything like this in my bin folder before.
The operation that I am doing is :
var distributor = new ReplicationServer(conn);
if (!distributor.DistributorInstalled)
{
distributor.InstallDistributor((string)null, distributionDb);
}
I am using the Microsoft.SqlServer.SqlManagementObjects nuget package with version 140.17177.0.
The fusion log in the exception is :
=== Pre-bind state information === LOG: DisplayName = Microsoft.SqlServer.BatchParser, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 (Fully-specified) LOG: Appbase = file:///C:/tfs/Back Office/Persistence/ReplicationManagement/Worker/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : Microsoft.SqlServer.BatchParserClient, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\tfs\Back Office\Persistence\ReplicationManagement\Worker\bin\Debug\Worker.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Post-policy reference: Microsoft.SqlServer.BatchParser, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 LOG: Attempting download of new URL file:///C:/tfs/Back Office/Persistence/ReplicationManagement/Worker/bin/Debug/Microsoft.SqlServer.BatchParser.DLL. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
The BatchParser file does exist in the bin with the same version specified. I have one project where this works, and the only difference is the file name in the output.