5
votes

Writing a routine WinForms app that references a few custom libraries written by myself. I am building one particular library which depends on another library and, when I do, I get the following warning message:

"Could not load file or assembly 'RHLib' Version 1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified"

The application functions, there are no error messages, but I am one of those that likes a completely clean compile - no errors, no warnings. And I cannot figure this one out.

The library in question has a reference to the "missing" library, the "missing" library is compiled and lives in the Debug directory when VS finishes compiling, the build order places the "missing" library as the first item built and the "missing" library has no dependencies - its a small library built to get me out of a circular assembly problem.

Any ideas?

3
Did you add the references by browsing to the debug folders, or by adding as project references?Rowland Shaw
What assembly version does RHLib have?Steve Gilham
Answer to 1: Added via project reference. All assemblies in question are in the same solution. Answer to 2: Nope - all code is written by myself. There are no third party tools here and no projects have been moved. Answer to #3: 1.0.0.0Bruce

3 Answers

7
votes

Even though the warning was coming from the library that used the "missing" library, adding a reference to the application which called the library which called the "missing" library removed the warning.

Explanation: The original assembly (we'll call it AS0) called another assembly (we'll call this one AS1). AS1 was in the reference list of AS0, however, AS1 called still another assembly (we'll call it AS2) and, of course, AS2 is in the reference list of AS1 but NOT in the reference list of AS0. To solve the problem, I added AS2 to the reference list of AS0. That did the trick.

3
votes

Did you right click on the project, and click Add Reference, and then add using RHLib; to the top of the file?

1
votes

Edit the web.config file to remove the reference, which is not required for normal operation:

1 - Open the web.config file in the root of your site

2 - Find the following line and comment it out():

<add assembly="xxxxx", Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

3 - Save and close the web.config file and try again

Ref Link : http://manual.aspdotnetstorefront.com/p-1118-could-not-load-file-or-assembly-microsoftwebservices3-version3000-cultureneutral-publickeytoken31bf3856ad364e35.aspx