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.

About Craig Stasila

Craig Stasila is a senior partner consultant with DataXstream, LLC. He has over twelve years of experience with SAP integration and is an innovative leader who is familiar with current advances in technology, especially in cross application interfacing.

Comments

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

    Regards,

  2. Martin van Kints says:

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

  3. Great solutions. worked for me.

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

  5. 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. Thanks a lot!!! problem solved!!!

  7. Sreepadha says:

    Thanks a lot..
    Saved Lot of time

Add Comment Register



Speak Your Mind

*