Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

FileLoadException in InitializeComponent in production PC

0.00/5 (No votes)
15 Jul 2013 1  
FileLoadException in InitializeComponent.

Introduction 

Have you ever created a project that runs perfectly (yea right!) in your pc but when you deploy it at the production pc it crashes before the first window appear? In most of the cases windows will prompt you to send the error to Microsoft and if you press the link 'What data does this error report contain?' you will see the exception that causes the problem. If this is a FileNotFoundException then the problem is that you haven't shipped every assembly your application needs or you have shipped the wrong version.

Assembly Binding Log Viewer 

Most fortunately Microsoft have created a tool that can help us to trace down what assembly is causing the problem. This tool is called FUSLOGVW.exe and you can find it in your development environment under the 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin' folder. You may copy this file to the production environment and run it. If it fails to load then try to copy flogvwrc.dll from the 'Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\' folder (I didn't need this DLL in Windows Embedded).

Settings 

Before you can use it you have to set the Log settings. Press the settings button from the right list and

  • check 'Enable custom log path'
  • set a path at the TextBox, e.g., 'C:\TEMP
  • select the radiobutton 'Log all binds to disk' 

How to use it 

Now you can run your application and then press 'refresh' at Fuslogvw. You will see a list of all bindings your application uses. The first item is the problematic assembly, it's the last tried loading assembly and the root of the problem. Try to solve this bad reference ether by coping the correct assembly to the production PC or by referencing the correct assembly from your code.

If the problem persist then follow the above steps to see the rest problematic assemblies. 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here