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

落爺英雄遲暮 提交于 2019-12-23 09:29:46

问题


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!)


回答1:


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




回答2:


reinstall MSChart.exe

this helped me!




回答3:


I know it has been a while since this problem was posted, but I just had the same problem and managed to solved it.

In order to run the application on other machines, I installed Microsoft Chart Controls on the other machines - just by downloading and running the MSChart.exe at http://www.microsoft.com/download/en/details.aspx?id=14422.




回答4:


This specific issue was discussed on MSDN:

http://connect.microsoft.com/VisualStudio/feedback/details/538952/clickonce-cannot-include-system-windows-forms-datavisualization-dll

That post points to a suggested solution:

http://www.thehat.free-online.co.uk/MSChart/

Generally, Fuslogvw (fusion log viewer) is your friend understanding why references cannot be loaded by .NET.

When logging is active, the strategy used to try and resolve dependencies is logged and fuslogvw lets you see the strategy.

Run in the computer where the DLL is found and the computer where it is not found and compare the log results.




回答5:


Maybe the dll is in your GAC so .net find it. But you don't deploy it with your application and it failed on other computers. What you can do is find the dll add it as a reference to your project (because you lose it) and ensure that copy local is set to true.




回答6:


Just Change version the in web.comfig file

EX:- namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"



来源:https://stackoverflow.com/questions/8013606/could-not-load-file-or-assembly-error-works-on-my-computer-but-not-others

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!