Click here to Skip to main content
15,860,943 members
Articles / Programming Languages / Visual Basic
Tip/Trick

FileLoadException in InitializeComponent in production PC

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
15 Jul 2013CPOL2 min read 7K   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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer menelabs
Greece Greece
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --