How to enable assembly bind failure logging (Fusion) in .NET
Solution 1:
Add the following values to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion Add: DWORD ForceLog set value to 1 DWORD LogFailures set value to 1 DWORD LogResourceBinds set value to 1 DWORD EnableLog set value to 1 String LogPath set value to folder for logs (e.g. C:\FusionLog\)
Make sure you include the backslash after the folder name and that the Folder exists.
You need to restart the program that you're running to force it to read those registry settings.
By the way, don't forget to turn off fusion logging when not needed.
Solution 2:
I usually use the Fusion Log Viewer (Fuslogvw.exe from a Visual Studio command prompt or Fusion Log Viewer from the start menu) - my standard setup is:
- Open Fusion Log Viewer as administrator
- Click settings
- Check the Enable custom log path checkbox
- Enter the location you want logs to get written to, for example,
c:\FusionLogs
(Important: make sure that you have actually created this folder in the file system.) - Make sure that the right level of logging is on (I sometimes just select Log all binds to disk just to make sure things are working right)
- Click OK
- Set the log location option to Custom
Remember to turn of logging off once you're done!
(I just posted this on a similar question - I think it's relevant here too.)
Solution 3:
If you have the Windows SDK installed on your machine, you'll find the "Fusion Log Viewer" under Microsoft SDK\Tools (just type "Fusion" in the start menu on Vista or Windows 7/8). Launch it, click the Settings button, and select "Log bind failure" or "Log all binds".
If these buttons are disabled, go back to the start menu, right-click the Log Viewer, and select "Run as Administrator".
Solution 4:
You can run this Powershell script as administrator to enable FL:
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath -Value 'C:\FusionLog\' -Type String
mkdir C:\FusionLog -Force
and this one to disable:
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath