问题
I have spent days looking for an answer but have not figured out what happens.
I have a solution with 4 projects. One of them is referenced to other 3. All references are set "copy local = false".
I have made output folders for each of them and everything was going great, until I decided to change the output folder. :-(
Now when I reference the project to another with property "copy local = false" project does not load and I have an error saying
Could not load file or assembly "..." or one of its dependencies. The system cannot find the file specified.
I am quite sure from the FusionLog of the error that Studio is still looking for the project's .dll at the old path.
When I set "copy local = true" projects runs but this solution is not acceptable.
What should I do so I can load my project again with copy local set to false? How can I change the path that Visual Studio is looking? Is there a cache that I can clear or update?
Thanks in advance for any help on this.
回答1:
Add this to your dependant project's app.config (I.E. the project that has the dependencies on the other projects):
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="*relative path to assemblies here*" />
</assemblyBinding>
</runtime>
With 'relative path to assembly here' replaced with the actual relative paths to where the assemblies are built (your new output folder(s)).
MSDN
回答2:
- Take a backup copy of your entire solution (all files)
- Locate your solution (.sln) file.
- Right click on its icon and select "Open with" and then select NotePad or a similar text editor.
- Search for part or all of the old path.
- If you find it in the file, replace all instances of the old path with the new path.
- Save the file.
来源:https://stackoverflow.com/questions/17837609/copy-local-false-referenced-project-shows-could-not-load-file-or-assembly