DataXstream OMS+

NCo 3.0 Error: Could not load file or assembly ‘sapnco_utils.dll’ or one of its dependencies

NCo 3.0 Error: Could not load file or assembly ‘sapnco_utils.dll’ or one of its dependencies

Recently I was deploying a Windows Service that uses SAP .NET Connector 3.0 on a fresh install of Windows (the specific version isn’t important, but it was Windows Server 2003).  I built my installer package, installed .NET Framework 4, and installed my program.  When it came time to execute my service, I received the following error message.

System.TypeInitializationException: The type initializer for
  'SAP.Middleware.Connector.RfcServerManager' threw an exception.
  ---> System.TypeInitializationException: The type initializer for
  'SAP.Middleware.Connector.RfcConfigParameters' threw an exception.
  ---> System.IO.FileNotFoundException: Could not load file or
  assembly 'sapnco_utils.dll' or one of its dependencies.
  The specified module could not be found.
at SAP.Middleware.Connector.RfcConfigParameters..cctor()
--- End of inner exception stack trace ---
at SAP.Middleware.Connector.RfcConfigParameters.Initialize()
at SAP.Middleware.Connector.RfcServerManager..cctor()
--- End of inner exception stack trace ---
at SAP.Middleware.Connector.RfcServerManager
.GetServer(String serverName, Type[] rfcFunctionHandlers)
at DataXstream.AwesomeProduct.InitializeSap()

What was really confounding was that the Fusion Log reported no .NET binding errors! So, what was going on?

Missing Prerequisite!

It turns out that I was missing a prerequisite.  In addition to .NET Framework 4, SAP .NET Connector (NCo) 3.0 Microsoft Visual C++ 2010 Redistributable Package (mscvp100.dll, mscvr100.dll).  After I installed it, everything ran like a champ!  I was a little miffed that the OSS Note I was using as my guide (856863) made no mention of the Microsoft Visual C++ 2010 prerequisite.  So, for all of you that may have similar issues, here is a comprehensive installable prerequisite list (with links!) for the SAP .NET Connector (NCo) 3.0 separated by your program’s target processor architecture and .NET version:

NCo 3.0 32-bit (x86), .NET 2.0 (also 3.0, and/or 3.5)

NCo 3.0 64-bit (x64), .NET 2.0 (also 3.0, and/or 3.5)

NCo 3.0 32-bit (x86), .NET 4.0

NCo 3.0 64-bit (x64), .NET 4.0

One More Thing!

It is important to understand the relationship between your .NET project’s target platform and the prerequisites.  The 64-bit version of the Microsoft Visual C++ 2010 Restributable Pack will not work if your project’s target is for a 32-bit architecture.  Be mindful to match the project platform to the prerequisite.

12 Comments

  1. Avatar for Paulo Matos
    Paulo Matos
    October 19, 2012 at 6:51 am · Reply

    Thank you for your amazing explanation.
    Finally, my problem is solved!

    Regards,

  2. Avatar for Martin van Kints
    Martin van Kints
    February 15, 2013 at 4:43 am · Reply

    Thanks a lot. This was exactly what I was looking for.

  3. Avatar for Thams
    Thams
    March 21, 2013 at 4:55 am · Reply

    Great solutions. worked for me.

  4. Avatar for Sjonny
    Sjonny
    April 3, 2013 at 4:15 am · Reply

    Thanks a lot!!! Been struggling for days and this was what I was looking for!

  5. Avatar for sandro
    sandro
    May 14, 2013 at 12:00 pm · Reply

    In my case i had to add the reference sapnco_utils.dll to the web site properties page (shift+F4) references.
    (besides the bin folder)

    regards

  6. Avatar for anta
    anta
    July 25, 2013 at 5:01 am · Reply

    Thanks a lot!!! problem solved!!!

  7. Avatar for Sreepadha
    Sreepadha
    August 23, 2013 at 2:27 am · Reply

    Thanks a lot..
    Saved Lot of time

  8. Avatar for Enrico
    Enrico
    May 27, 2014 at 5:51 am · Reply

    It works for me too

  9. Avatar for caiqixian
    caiqixian
    June 9, 2015 at 9:07 pm · Reply

    Thanks a lot!! It’s helpful.

  10. Avatar for Ulrich Schmidt
    Ulrich Schmidt
    November 16, 2015 at 9:03 am · Reply

    Just a small correction: the .NET 2.0 versions of NCo require the Microsoft Visual C++ runtime 2005 SP1, not 2008.
    See https://service.sap.com/connectors –> SAP Connector for Microsoft .NET –> Prerequisites

  11. Avatar for Avinash Sahu
    Avinash Sahu
    May 15, 2018 at 4:20 pm · Reply

    This is awesome, helped me fix the issue. Thanks much!!

  12. Avatar for Alan
    Alan
    January 3, 2019 at 10:27 am · Reply

    You, my friend, are the best. Thanks for share this post, help me a lot!

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.