locked
Can not find Microsoft.SqlServer.InstApi when trying to run a SMO trace RRS feed

  • Question

  • I install the follwing components

    1.Microsoft SQL Server 2005 Management Objects Collection

    2.Microsoft Core XML Services (MSXML) 6.0

    3.Microsoft SQL Server Native Client

    (available from http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&DisplayLang=en)

    on a clean machine with no SQL Server 2005 client tools.

    I get the following error.

    Failed to initialize object as reader.
    Could not load file or assembly 'Microsoft.SqlServer.Instapi, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

     

    A gacutil tells me that this assembly is not installed.

    Is there are way to run SMO trace without having to install the 2005 client tools and only the Management Objects Collection and necessary components?

    Sample code:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Microsoft.SqlServer.Management.Trace;
    using Microsoft.SqlServer.Management.Common;


    namespace SMOTraceTestProgram
    {
        public partial class Form1 : Form
        {
           

            public Form1()
            {
                InitializeComponent();
            }


            private void bStart_Click(object sender, EventArgs e)
            {


                TraceServer smoTraceServerReader;

                ConnectionInfoBase cInfoBase = new SqlConnectionInfo();
                SetupConnectionInfoBase((cInfoBase as SqlConnectionInfo));

                smoTraceServerReader = new TraceServer();

                try
                {
                    smoTraceServerReader.InitializeAsReader(cInfoBase, "2005NOSPIDFilter.tdf");
                    smoTraceServerReader.Stop();
                    MessageBox.Show("Trace Started and stopped successfully");
                }
                catch (Exception exception)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(exception.Message);

                    Exception ex = exception.InnerException;
                    while(ex != null)
                    {
                        sb.Append(ex.Message);
                        ex = ex.InnerException;
                    }
                    MessageBox.Show(sb.ToString());
                }

            }

            private void SetupConnectionInfoBase(SqlConnectionInfo sqlConnectionInfo)
            {
                sqlConnectionInfo.ServerName = eSeverName.Text;


                if (eUserName.Text.Length > 0)
                {
                    sqlConnectionInfo.UserName = eUserName.Text;
                    sqlConnectionInfo.Password = ePassword.Text;
                    sqlConnectionInfo.UseIntegratedSecurity = false;
                }
                else
                {
                    sqlConnectionInfo.UseIntegratedSecurity = true;
                }

            }

         }
    }

     

     

     

     

     

    Wednesday, April 19, 2006 6:14 AM

Answers

  • I have reproduced this issue in house and can confirm that this is a problem with the Microsoft SQL Server 2005 Management Objects Collection. We will consider this issue for inclusion in Service Pack 2.

    As for workarounds, I don't have one. I tried Gac'cing the missing DLL, but there is apparently more registration required, as evidenced by the new error message I got. ("Failed to initialize object as reader.Failed to get SQL Tools directory path from InstAPI.") 

    Thursday, April 20, 2006 9:05 PM

All replies

  • I have reproduced this issue in house and can confirm that this is a problem with the Microsoft SQL Server 2005 Management Objects Collection. We will consider this issue for inclusion in Service Pack 2.

    As for workarounds, I don't have one. I tried Gac'cing the missing DLL, but there is apparently more registration required, as evidenced by the new error message I got. ("Failed to initialize object as reader.Failed to get SQL Tools directory path from InstAPI.") 

    Thursday, April 20, 2006 9:05 PM
  • Thanks James,

    Appreciate the feedback. For the time being I will get the users of my profiling tool to install management tools from the SQL Server 2005 Install.  This seems to install the necessary components for SMO Trace to work. 

    Look forward to a fix though, as this installs a lot more than is required.

     

     

     

    Thursday, April 20, 2006 10:04 PM
  • Hello James,

     

    I've encountered the same situation! I've installed the SMO package along with MS XML 6.0 and SQL Native Client packages from: http://www.microsoft.com/downloads/details.aspx?FamilyID=50b97994-8453-4998-8226-fa42ec403d17&DisplayLang=en. They are the latest and I believe that what you meant by Service Pack 2. The packages were installed on a clean Windows Server 2003 SP1 system with .NET 2.0 and SQL 2000 SP4. However, when I tried to run a trace (using TraceServer class), I got the same error as in the post above.

     

    I'd really appreciate any suggestions or workarounds!!!

    Thursday, April 17, 2008 7:45 PM
  • we are having the same error trying to install sql server 2008 with the 2005 components (sp3) for a biztalk 2009 installation. same error message about the same dll with the same public token :( has this been fixed yet or is a workaround known? btw this is on x64 - the 32bit version installed fine. error below:

    TITLE: Microsoft BizTalk Server 2009 Configuration Wizard

    ------------------------------

     

    Error configuring BAM Tools (BAMTools)

     

    For help, click: http://go.microsoft.com/fwlink/events.asp?ProdName=Microsoft+BizTalk+Server+2009&ProdVer=3.8.368.0&EvtSrc=BAMTools&EvtID=idsErrorConfiguringTools

     

    ------------------------------

    ADDITIONAL INFORMATION:

     

    Error executing bm.exe with tracing enabled. (Microsoft.BizTalk.Bam.CfgExtHelper.Utility)

     

    For help, click: http://go.microsoft.com/fwlink/events.asp?ProdName=Microsoft+BizTalk+Server+2009&ProdVer=3.8.368.0&EvtSrc=Microsoft.BizTalk.Bam.CfgExtHelper.Utility&EvtID=error_ExecuteBm

     

    ------------------------------

     

    Error executing process: C:\Program Files (x86)\Microsoft BizTalk Server 2009\Tracking\bm.exe (Microsoft.BizTalk.Bam.CfgExtHelper.Utility)

     

    For help, click: http://go.microsoft.com/fwlink/events.asp?ProdName=Microsoft+BizTalk+Server+2009&ProdVer=3.8.368.0&EvtSrc=Microsoft.BizTalk.Bam.CfgExtHelper.Utility&EvtID=error_ExecuteProcess

     

    ------------------------------

     

    Microsoft (R) Business Activity Monitoring Utility Version 3.8.368.0

    Copyright (C) 2006 Microsoft Corporation.  All rights reserved.

     

    ERROR: Failed to set up BAM database(s).

    There was a failure while executing nscontrol.exe. Error:"Microsoft Notification Services Control Utility 9.0.242.0

    Microsoft Corp. All rights reserved.

     

    An error was encountered when running this command.

    Could not load file or assembly 'Microsoft.SqlServer.Instapi, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

     

    "

     

     (Microsoft.BizTalk.Bam.CfgExtHelper.Utility)

     

    For help, click: http://go.microsoft.com/fwlink/events.asp?ProdName=Microsoft+BizTalk+Server+2009&ProdVer=3.8.368.0&EvtSrc=Microsoft.BizTalk.Bam.CfgExtHelper.Utility&EvtID=error_ExecuteProcess

     

    ------------------------------

    BUTTONS:

     

    OK

    ------------------------------

    • Edited by David Pickering Friday, December 4, 2009 10:55 AM added error message details
    Friday, December 4, 2009 10:49 AM