I have a small app which references the Microsoft.SqlServer.Smo assembly (so I can display to the user a list of servers & databases to which they can connect).
My application originally referenced Microsoft.SqlServer.Smo and Microsoft.SqlServer.ConnectionInfo. Things worked as expected on my dev box.
When I installed the application on a test machine, I received a System.IO.FileNotFoundException. The details of the message included the following: Could not load file or assembly Microsoft.SqlServer.SmoEnum
I eventually resolved the issue by referencing the following assemblies in addition to the ones mentioned above:
- Microsoft.SqlServer.SmoEnum
- Microsoft.SqlServer.SqlEnum
- Microsoft.SqlServer.BatchParser
- Microsoft.SqlServer.Replication
Can anyone confirm that I do indeed need to include each of these additional assemblies in my application (and therefore install them on user’s machines) even though the app builds fine on my development box without them referenced?
Yes, they do need to be included. On the development machine you probably have SQL Server installed, which places those assemblies into the Global Assembly Cache. Whenever you build, Visual Studio just pulls from them from the GAC. It also assumes that the GAC of whatever computer it will be deployed on will also have those files. If not, it throws the FileNotFound exception.