问题
I have created a C# application which referenced various v11 SQL Server SMO assemblies. I've done this by taking copies of these, referencing them with Copy Local=True
in the properties of the Reference, and then including them with copies of the application. The application is deployed to 50 or so machines on our company network, some developer PCs, some servers. I started to receive the error
Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
on some of these servers, so I took the v12 DLL and replaced the reference with this one, assuming it would be backward compatible. This fixed the issue on the servers which were reporting the error shown above, but now, some servers are reporting the error
Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
This error has also occurred with one or two of the other libraries in the SQL SMO namespace, I have upgraded a number of them.
What is the correct method to reference these DLLs to work across any server, regardless of which DLLs are available there?
来源:https://stackoverflow.com/questions/33566828/sql-smo-dll-references-v12-v11-could-not-load