Geeks With Blogs
Geekette's Blogette Trying to keep up with technology


I recently discovered two things while working with SMO in a Web application.

  1. If SQL Server is not installed on the production Web server, you can copy the SMO assemblies to the /bin folder of the Web application and set the refrences to that location (instead of the GAC for a machine that has SQL Server Tools installed).
  2. Sometimes assemblies can disappear from the GAC.  If your SMO assemblies disappear you need to reinstall the Sql Server SDK (the physical location is C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies).  
    • When you are changing (repairing) the SDK install, make sure the CD you are using is not an earlier version of the SDK.  You get a general message like:  the installation was stopped because no additional features that are not already installed were selected. 


I've been helping with an 2.0 Web app that needs to execute an SSIS job.  Code was written to use the the SMO (Sql Server Management Objects).  I set a refererence to the following assemblies:

  • Microsoft.SqlServer.ConnectionInfo
  • Microsoft.SqlServer.Smo
  • Microsoft.SqlServer.SmoEnum
  • Microsoft.SqlServer.SqlEnum

Everything was working fine. UNTIL: The Web appplication was deployed on the production Web server.  The following error was received: 

Unable to load assembly.... Microsoft.SqlServer.ConnectionInfo

Initial research indicated it might be related to having 1.1 and 2.0 Framework on the same server.  Since this was the first 2.0 Web app on the box went down that path for a while.  Tried some suggestions from other blogs.  Still not working.

Deciding that it was not a 1.1 / 2.0 problem began working with the Microsoft.SqlServer.ConnectionInfo assembly.  I checked the refefrences on my laptop and noted that this assembly was being read from the GAC.  The production Web server did not have Sql Server installed; therefore, probably did not have the assembly in the GAC.  Maybe I could just load the assemblies into the /bin folder for the Web application.

Next I decided to test the theory on my laptop.  Only problem was, I couldn't find the .dll.  Did a Windows search of the entire laptop and still couldn't find it.  A little more digging uncovered the fact that I no longer had a valid reference.  It had been a while since I had run the app, and apparantly the .dlls were no longer on my laptop.  Who knows where they went (perhaps they disapparated!)

I learned that the assemblies should reside in C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies. 

Ok, fine... Annoying, but just reinstall them.  Figuring it was related to SSIS, checked that SSIS was still installed and it was.  Used the control panel - Add/remove programs - and tried to repair SQL server.  Added the tools.  Message returned  - the installation was stopped because no additional features that are not already installed were selected. 

Uninstall and reinstall SSIS.  Still on asssemblies on the laptop.

Change (repair) the SDK.  I tried this and again received the message "the installation was stopped because no additional features that are not already installed were selected."  I noticed a link "Details" (I think), so I clicked it and discovered that I was trying to install an earlier version of the SDK so the installation was cancelled.  I changed to a new CD and tried again.  Success.  The assemblies were now located in the expected path. 

Posted on Tuesday, July 24, 2007 5:07 PM | Back to top

Comments on this post: Cannot set SMO reference

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Robin Edwards | Powered by: