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

6

7

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

Forfend answered 4/11, 2011 at 17:44 Comment(5)
Sounds like the dll isn't where you think it is. Are you sure of the location? Have you tried deleting the reference and re-adding it?Shinberg
Have you tried installing .Net 3.5 on one of the machines that is having the problem? If so, I think you need to redistribute System.Windows.Forms.DataVisualization with your app, because I think it might not be a part of the base .Net Framework. Google seems to corroborate my thoughts...Atman
@timmy My project is 3.5. The project was started in VS2008 Express and now we own VS2010. I thought I'd keep it as 3.5 to minimize things that could go wrong but this appears to be a side effect, maybe?Forfend
Another solution would be to upgrade to .Net 4.0, since the chart control was incorporated into the core .Net framework in 4.0Picaroon
@Picaroon FYI, about a year later that is exactly what happened. It was the right call for more than one reason.Forfend
C
19

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

Cesar answered 4/11, 2011 at 17:49 Comment(1)
Downloading this did it! now I just need to have it available as a prereq like in @Eric J's answer.Forfend
S
3

reinstall MSChart.exe

this helped me!

Scanderbeg answered 23/5, 2015 at 12:59 Comment(0)
G
2

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.

Gatehouse answered 22/12, 2011 at 18:56 Comment(1)
This is ultimately what I had to do. Although it means the user needs to reboot now AND run a separate install (mostly because I'm yet to figure out how to successfully make an installer). Overall a disappointing change from VS2008/.NET3.5Forfend
S
1

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.

Salinger answered 4/11, 2011 at 17:48 Comment(2)
The MSCharts.exe file is correct and works, however, I cannot seem to add it as a prereq. I followed the instructions on the thehat.free-online.co.uk/MSChart link. no luckForfend
I'm still unable to get the charting component to show up under the Prereqs. How can I get VS to acknowledge the files I've created via the link?Forfend
C
0

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.

Catechu answered 4/11, 2011 at 17:48 Comment(0)
I
0

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"

Intersperse answered 20/12, 2014 at 12:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.