I have a Windows forms application targeting .NET 4.5. The application provides functionality for programmatic database backup and restore using SQL Server Management objects (SMO).
The application should support Express editions of both SQL Server 2008 R2 and SQL Server 2012 as its using only features that are supported in both versions.
Now the SMO assemblies (Microsoft.SqlServer.ConnectionInfo, Microsoft.SqlServer.Smo, Microsoft.SqlServer.SmoExtended
etc.) to reference in the project will be in different folders depending on the version of SQL Server the client has installed
SQL Server Express 2008 R2: C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies
SQL Server Express 2012: C:\Program Files\Microsoft SQL Server\110\SDK\Assemblies
As you can see, when the client is running 2008 R2, the assemblies will be down the 100\SDK
folder while for those that want to run SQL Server 2012, they will be in the 110\SDK
folder.
So if I reference the 100\SDK
folder, the application will break for clients running SQL Server 2012 because they will only have the 110\SDK
folder.
So how is such a scenario normally handled?
If you want to develop an application that uses SQL Server Management Objects (SMO), you should select the Client Tools SDK when you install SQL Server.
To install the Client Tooks SDK without installing SQL Server, install Shared Management Objects from the SQL Server feature pack.
If you want to ensure that SQL Server Management Objects is installed on a computer that will run your application, you can use the Shared Management Objects .msi in the SQL Server feature pack.
Source: Installing SMO - SQL Server 2012
Going by the underlined paragraph, I guess I can always install a common Shared management objects msi across client machines irrespective of sql server version being run.