问题
I have a C++ assembly with both managed and umanaged code compiled to a DLL. It is correctly imported into the project references as I can see all my classes and their members with the Object Browser.
The problem is with the XAML Design view. In my XAML code I want to make a data bind with my C++ assembly so I have the namespace like so:
xmlns:kudu="clr-namespace:kudu;assembly=CLI"
CLI is the name of the dll and it has a namespace inside called kudu. The Design view refuses to shows the XAML and gives me this error:
Assembly 'CLI' was not found. Verify that you are not missing an assembly reference. Also, verify that your project and all referenced assemblies have been built.
The best part is I can actually build the entire solution and everything works! The window updates as the C++ objects change and what not. However with out the Design view this makes continuing development quite difficult.
Does anyone have an answer as to why this happens and how I can fix it?
回答1:
This is probably happening because the ide cannot load one of the unmanaged dll's. You may have to move them into the windows/system32.
回答2:
An alternative solution I've found to this is add to the windows PATH variable the bin directory of my assembly which has all the DLLs.
回答3:
Very helpful, thanks for this insight.
My solution is to copy the DLLs into the output directory using a Post-Build event. Here's how 1. Project Properties / Build Events 2. Set Post-build event command line:
copy path_to_dependent_dlls .
Oh, and I find that a VStudio restart is required for it to start working ...
来源:https://stackoverflow.com/questions/278416/vs2008-xaml-design-view-chokes-on-namespaced-c-assembly