WPF assembly reference missing - project still building
I am trying to use the Dynamic Data Display library for WPF in my solution. I added a reference to DynamicDataDisplay.dll
in my project. I also added a namespace in the .xaml like this: xmlns:d3="http:开发者_开发问答//research.microsoft.com/DynamicDataDisplay/1.0"
Intellisense is not helping me when I try to add a element from the Dynamic Data Display library. When I type something like this in my .xaml:
<d3:ChartPlotter></d3:ChartPlotter>
Visual studio will mark it as an error with some text like:
The type 'd3:ChartPlotter' was not found. Verify that you are not missing an
assembly reference and that all referenced assemblies have been built.
But the odd thing about it is that it still compiles. Can someone please tell me what I am doing wrong?
Here is a sample code which compiles fine but is showing an error in the designer:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
Title="MainWindow" Height="350" Width="525">
<Grid>
<d3:ChartPlotter></d3:ChartPlotter>
</Grid>
Edit:
I tried the namespace declaration like Merlyn Morgan-Graham suggested but it still does not work. Another error occurred:
Unable to load the metadata for assembly 'DynamicDataDisplay'.
This assembly may have been downloaded from the web.
See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered
during load: etc.
It seems like that assemblies that were downloaded need to be manually unblocked. This can be done in the Windows file properties. After unblocking and a restart of Visual Studio the problem was solved.
(source: www.xup.in)This appears to be a schema reference, not an assembly reference.
Something like this might work better:
xmlns:d3="clr-namespace:Microsoft.Research.DynamicDataDisplay;assembly=DynamicDataDisplay"
http://msdn.microsoft.com/en-us/library/ms747086.aspx
Edit
I think I found the library you are using, so I updated the XAML namespace reference to what I think will work for you. If not, check the docs, or start editing some code, and figure out the namespace that the ChartPlotter class lives in.
An additional point for other readers: if you projects builds successfully, but you get this error message while trying to load your view in the designer, make sure your assembly is x86 or Any CPU, because Visual Studio 2010 is a 32bit process and cannot load x64 assemblies in the designer.
I got the same "Unable to load metadata" error when referencing the DLL file found in binary version of Dynamic Data Display Library. The problem was solved when I downloaded the source version of the library and compiled it myself. When referencing the DLL under DynamicDataDisplay_0.3/sln/DynamicDataDisplay/Debug/bin , it worked just fine.
I suppose the problem is with some permissions of the DLL, as pointed already at the end of the question - you can "unblock it", see above.
I had similar problems, I was following the steps to create a first sample project as outlined here, https://github.com/Microsoft/InteractiveDataDisplay.WPF
This currently applies to,
- NuGet package avostres.InteractiveDataDisplay.WPF v1.0 and
- NuGet package InteractiveDataDisplay.WPF v1.0
- my project target framework is .NET 4.6.1 / V.S Pro V15.7.3
It builds but you get a runtime error. It seems to be a compatibility issue due to recent tinkering by Microsoft. Use NuGet to install an additional package,
- System.Reactive.Compatibility V4
this fixed the problem for me.
I found the fix discussed on a github forum by StephanBartels here, https://github.com/louthy/echo-process/issues/19
精彩评论