SMO code to backup on SQL 2005 and restore on 2008R2

Answered SMO code to backup on SQL 2005 and restore on 2008R2

  • Wednesday, August 01, 2012 2:22 PM
     
     

    Hello,

    I am writing a piece of code in .NET which will use the SMO API to backup a database on a SQL 2005 box and then restore it on a SQL 2008 R2 box.

    The problem which I am facing is that which SMO DLL to reference?

    If I reference 2008R2 SMO DLL and compile the code with .NET 2.0 then it does not work on the SQL box. If I reference the 2005 DLL, then it does not work on 2008 box.

    if I create two vs.net projects under a solution  and then try to reference 2005 DLL in one project and 2008R2 DLL in one projet... vs.net wans me on a conflict in DLLs even though I have two separate projects.


    val it: unit=()

All Replies

  • Wednesday, August 01, 2012 3:52 PM
     
     Answered

    If I reference 2008R2 SMO DLL and compile the code with .NET 2.0 then it does not work on the SQL box. If I reference the 2005 DLL, then it does not work on 2008 box.

    Hello,

    Use the newer SMO of SQL Server 2008R2; on the machine with SQL Server 2005 install SMO 2008R2, which is available as a separate, small installer in SQL Server 2008 R2 Feature Pack => Microsoft® SQL Server® 2008 R2 Shared Management Objects (=SMO)


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing

    • Marked As Answer by MSDN Student Tuesday, August 07, 2012 1:53 PM
    •  
  • Wednesday, August 01, 2012 5:53 PM
     
     

    could there be an app.config trick? so i have 1 code but 2 app.config? 1 app.config binds me to 2005 smo dll and the other one binds me to 2008r2 dll?

    in my organization installing an MSI on a prod server is a very very BIG deal... that is crappy.... but that's the way it is .....


    val it: unit=()

  • Thursday, August 02, 2012 2:48 AM
     
     

    Not as far as I known.

    But at all, you can run the app on one machine; with SMO you can do all remote (like with SSMS), it's not neccesary to do it all local.


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing