I am using .net framework 4.0 and working on Web deployment Setup, I have referenced the SMO Assemblies of sql server 2008, and When I Call ExecuteNonQuery Function in my setup using Smo Assemblies it gives me this error “Mixed mode assembly is built against version ‘v2.0.50727’ of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.” but sometimes it works correctly in my code but some time it gives this error,
I have using the same class, same method sometimes its run correctly and some time it gives this error, I am completely fade up with this error, I couldn’t find any reason for that and I also want to know is SMO assemblies are available in .Net framework v4.0?
From: http://social.msdn.microsoft.com/Forums/en-US/sqlsmoanddmo/thread/533f7044-1109-4b7a-a697-2621f23017d6
This is a known issue. SMO’s usage against .Net 4.0 hasnt been signed off or announced by microsoft.
There is an unsupported option to get this working (add this to your app.config):