我正在使用2008年视觉演播室,NET 3.5 SP1,并使用以下模块进行测试:
- a C++ DLL
- a C++/CLI DLL that uses #1
- a C# WPF application that uses #2
When I try to use classes from #2 as resources in the WPF XAML, the designer won t let me:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lib1="clr-namespace:ClassLibrary1;assembly=ClassLibrary1" <- ERROR
The error is: "Assembly ClassLibrary1 was not found. Verify that you are not missing an assembly reference. Also, verify that your project and all referenced assemblies have been built."
但是,当我从C++/CLI DLL中选取应用主窗的密码后,所有东西都行了。 第1类是创建的,在建筑商中,它向C++ DLL打电话,没有问题。
using ClassLibrary1;
...
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
//use in code-behind
Class1 tmp = new Class1();
tmp.FirstName = "foo";
Title = tmp.FirstName;
}
}
如果我修改C++/CLI组,将其呼吁移入C++ DLL并重建所有东西,设计者停止抱怨和装上C++/CLI大会而没有抱怨。
I suspect this problem has something to do with where the WPF designer looks for dynamic libraries.