FileNotFoundException thrown for a referenced asse

2019-04-09 15:54发布

问题:

I'm getting a really weird FileNotFoundException thrown the first time I try to use a class defined in an assembly I have referenced. The assembly hasn't changed, and the location in the project file corresponds correctly to the physical path on disk.

This suddenly started failing in a solution that consists of two library projects, a windows service project and a console application, when I added installers to the windows service and a setup project. However, I have the console app as a single startup object, there are no references in either way between the console application and the service/installer projects.

回答1:

If you enable Assembly Binding Logging, you will find that the FileNotFoundException will contain within it the complete fusion probing log for the missing file. Normally this makes the problem pretty obvious straight away.

See http://msdn.microsoft.com/en-us/library/e74a18c4(VS.80).aspx