1

Iam facing some issues when deploying sharpshell on the client machines, really appritiated if some one could help me out. The configurations as follows

  1. Sharpshell 2.2.0
  2. 64Bit OS
  3. Framework 4.5.1
  4. Vc++ 2010 redistributable
  5. Deployment package was built on x86 architecture

Once I go through the error logs Find out that a error "Failed to initialise the Nativebridge" is happening this is an awesome library work like charm in Dev Environment.

Machine Config Error Log

titan61
  • 33
  • 7

1 Answers1

1

Finally.. I found out a work around for the issues which I was facing :).

  1. First of all took the master branch form GET and made Nativebridge project to x64 Compactable. thanks to the ref

  2. Made some tiny changes under the file SharpShell\NativeBridge\NativeBridge.cs, function Initialise(), the lines where the nativeBridge Library is trying to load.The function looks as below after the edit during the time when I am writing this post.

            public bool Initialise()
    {
        //  Get the manifest resource name.
        var resouceName = GetBridgeManifestResourceName();
    
        //  We'll now try and get the bridge library path.
        string bridgeLibraryPath = string.Empty;
    
        try
        {
           int index = resouceName.LastIndexOf('.') > 0 ? resouceName.LastIndexOf('.', resouceName.LastIndexOf('.') - 1) : -1;
           string resouceNameTrimed = resouceName.Substring(index+1,resouceName.Length - (index+1));
           string ResourcePath = String.Format(@"{0}\{1}", System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),resouceNameTrimed);
    
           using (var resourceStream = File.OpenRead(ResourcePath))
            {
                //  Set the temporary path..
                bridgeLibraryPath = Path.GetTempPath() + Guid.NewGuid().ToString() + ".dll";
                using (var tempStream = File.Create(bridgeLibraryPath))
                {
                    resourceStream.CopyTo(tempStream);
                }
            }
        }
        catch (Exception exception)
        {
            //  Log the exception.
            Logging.Error("NativeBridge: Failed to extract the bridge library. The manifest path is '" +
                          bridgeLibraryPath + "'", exception);
            return false;
        }
    
        //  Load the bridge library.
        try
        {
            libraryHandle = Kernel32.LoadLibrary(bridgeLibraryPath);
    
        }
        catch (Exception exception)
        {
            //  Log the exception.
            Logging.Error("NativeBridge: Exception loading the bridge library.", exception);
        }
    
        //  If the library hasn't been loaded, log the last windows error.
        if (libraryHandle == IntPtr.Zero)
        {
            Logging.Error("NativeBridge: Failure to load the brige library.",
                          new Win32Exception(Marshal.GetLastWin32Error()));
            return false;
        }
    
        Logging.Log("Bridge Initialised");
    
        //  We've successfully loaded the bridge library.
        return true;
    }
    
    1. Made the sharpshell, servermanager projects etc to x64 compactable, just Changed the target frame work to x64 and rebuilt.

    2. Replace the sharpshell dll reference with the above in my project.

    3. Added files "SharpShellNativeBridge32.dll" and "SharpShellNativeBridge64.dll" to the working folder of my project.

Yep that was enough for my case work like charm afterwards

titan61
  • 33
  • 7