Reputation: 956
I have a project which using Microsoft.SqlServer.SMO.dll, which is always copying to bin directory (CopyLocal is set to true).
However, there may be installed different versions of SQL SMO. Thay have the same assembly version (10.0.0.0), but different file versions (10.0.1600.22 and 10.50.2500.0). The end user may have installed the older version of assembly to GAC, but I need to load always 10.50 from bin.
So, I have the following situation:
Bin -> 10.50.2500.0
GAC -> 10.0.1600.22
When my app is running, the assembly from GAC is loaded, and from bin is ignored.
How can I prevent such behaviour? Many thanks.
Upvotes: 2
Views: 257
Reputation: 3408
It's all about strict versioning. You're referencing dll versioned 10.50.2500.0 but you're not saying anything that it should be exactly THIS version.
So what you'll have to do is to set Specific Version to true in properties of the assembly you're referencing to. This will guarantee that exactly this version would be loaded
Upvotes: 1
Reputation: 15704
You can provide your own manifest for the application to tell it that you want to use the 'bin' location explicitly. It's a medium sized topic, but this a good link that will get you started.
http://msdn.microsoft.com/en-us/library/1w45z383.aspx
Upvotes: 1