Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Could not load file or assembly" Error. Works on my computer but not others

I have a solution with a single project file. I am deploying as a ClickOnce application. It all runs fine and well on my computer but when I try to run it on someone else's I get this error

System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Forms.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'System.Windows.Forms.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

System.Windows.Forms.DataVisualization is in facet loaded as a reference in my project and I believe there to be appropriate using statements where ever it is being used.

When I go to my project Properties>Publish>Application Files... System.Windows.Forms.DataVisualization has an exclamation point next to it that tooltip text of "This item is no longer referenced by the project. If it is no longer needed, it can be removed by right clicking on the item." the Publish status is "Include" and the Hash is "Include." the publish status is not, however, "Include (auto)"; Exclude has the auto text next to it. But whether I include or exclude I get the same error when running on someone else's machine.

What do you think I should do to get this file to be properly referenced?

Thanks

Update:

I've tried setting Local Copy = true, build rebuild to no avail.

I'm going through all the other suggestions now. (It's a long walk between me and the computer that doesn't work!)

like image 642
Brad Avatar asked Nov 04 '11 17:11

Brad


People also ask

How do you fix Could not load file or assembly or one of its dependencies?

There are some workarounds for this issue: The dll file may not be in /bin folder. Just copy the dll file to /bin folder or set this preference Copy Local = True from Visual Studio. If the problem persists, check if the version of the assembly that is referenced is different than the version it is looking for.

Could not load file or assembly from another project?

In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.

Could not load file or assembly Publickeytoken null or one of its dependencies?

This error usually means that the assembly was not found. Try verifying that the file exists in the directory where your application is running.

Could not load file or assembly Microsoft practices EnterpriseLibrary common?

This error means that ASP.NET was not able to find the EnterpriseLibrary dll. To fix it, try install Enterprise Library on the web server or upload the required dll into the bin folder.


1 Answers

Sounds like you need to include the linked download in the in your redist - even if you've got the assembly you'll probably be missing dependencies:

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=14422

like image 195
Jon Egerton Avatar answered Oct 21 '22 03:10

Jon Egerton