Unable to load 'onetnative.dll': The specified module could not be found
Question
This question arises as a result of this question, but I thought I would split it out into its own.
Anything using SPUtility.GetGenericSetupPath()
is returning null, e.g.
SPUtility.GetGenericSetupPath("config")
SPUtility.GetGenericSetupPath(string.Empty)
both return null. If I make those calls in a little console app and debug it in VS2008, it appears to execute fine with no exceptions (albeit with null returned from the method.) However I notice a message in the output window:
A first chance exception of type 'System.DllNotFoundException' occurred in Microsoft.SharePoint.dll
So if I get Visual Studio to break on all exceptions, even handled ones, the exception is as follows:
System.DllNotFoundException: Unable to load DLL 'onetnative.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I've checked and onetnative.dll does exist in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN.
Solution 2
As far as I can trace it back, this was caused by an installation of the wrong version of Microsoft J#.
J# is a pre-requisite of the Citrix Web Interface for SharePoint webparts. I installed the 32bit version mistakenly, then uninstalled and installed the 64bit version. I have a hunch (based on a good bit of testing, but not 100% verified) that this caused .NET/CLR applications to start looking in the 32bit node of the registry rather than 64bit.
OTHER TIPS
I would try copying the onetnative.dll to the same place as your console app and see if it makes a difference