Pregunta

I have downloaded the binaries of OxyPlot, but can't get it to work in my .Net 4.0 WPF application. I have added references to 'OxyPlot.dll' and 'OxyPlot.WPF.dll', and my code-behind recognizes it fine (I can, e.g., create an instance of PlotModel) but in my XAML view I have not been able to add the reference correctly. Following examples I have tried

<UserControl ...
xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf">

with all combinations of 'OxyPlot' and 'OxyPlot.Wpf' but I always get the error message:

Error 1 Unable to load the metadata for assembly 'OxyPlot.Wpf'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'OxyPlot.Wpf, Version=2014.1.1.1, Culture=neutral, PublicKeyToken=75e952ba404cdbb0' or one of its dependencies. Das System kann die angegebene Datei nicht finden.

I am using VS 2010 Express (i.e., I cannot install the package via Nuget :-( ...)

¿Fue útil?

Solución

The answer turned out to be simple: The instructions in the link http://go.microsoft.com/fwlink/?LinkId=179545 given in the error message really worked. One has to tell VS that these files are 'trusted', so

  • close VS
  • right-click on the .dll's and select 'properties'
  • in the 'general' Tab, press the 'unblock' button

What is really weird and kind of hilarious to me is that VS will let me work with these 'untrusted .dlls' just fine in c# code, but not in .xaml ...

Otros consejos

I solved the same problem restarting VS and as suggested by VS adding this line to the XAML Window property:

xmlns:oxy="http://oxyplot.org/wpf"

Hope this help.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top