Search code examples
vb.netwinformsvisual-studio-2013sql-server-2012smo

Using SMO with VS2013 Windows Desktop application project


I am building a VB.NET application in VS2013 that uses a database created in SQL Server 2012 (which is installed locally and on the only computer that the application will be run on).

I need to execute a SQL script when the user clicks on a button. I know that I need to Import resources from SMO but when I run the SharedManagementObjects.msi installer I get a message that says,

"Installation of Microsoft SQL Server 2012 Management Objects failed because a higher version already exists on the machine. To proceed, uninstall the higher version and then run Microsoft SQL Server 2012 Management Objects Setup again."

What do I need to do to get SMO installed to use in my project?


Solution

  • I am assuming you are using nuget??

    It appears that you must have 2014 installed, search for this in your installed packages and click uninstall. Now try and install the 2012 version.

    Or in the Package Manager Console:

    Uninstall-Package Unofficial.Microsoft.SQLServer.SMO.2014 Followed by:

    Install-Package Unofficial.Microsoft.SQLServer.SMO

    http://www.nuget.org/packages/Unofficial.Microsoft.SQLServer.SMO.2014/