Search code examples
c#embedded-resourcewindows-server-2012class-library

Resource file referenced in resx not found on windows 2012


I have a class library dll with an file embedded as a resource that is referenced in Resources.resx.

    internal class Resources {
        internal static byte[] LicenseFile {
            get {
                object obj = ResourceManager.GetObject("LicenseFile", resourceCulture);
                return ((byte[])(obj));
            }
        }
    }

This library is referenced by multiple applications such as a windows service.

This works without problems on local windows 7 machine or older windows server 2008.

But the service does not starts in windows server 2012 since it does not finds the file.

System.IO.FileNotFoundException is thrown as the system event log shows.

Update

I printed out stacktrace and it seems it cannot find the required dll. Its not the resource file at all.

Could not load file or assembly 'LeadTools.dll' or one of its dependencies. Module not found.

Dateiname: 'Leadtools.dll'
   at MyClassLibrary.Utils.InitLeadTools()
   at MyService.Logic.Program.Main(String[] args) 

Solution

  • LEADTOOLS binaries for .NET 4.0 require redistributing Microsoft Visual C++ 2010 runtime files.

    Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)

    Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)