English 中文(简体)
为什么世界森林论坛设计师未能把那些呼吁进入未管理的多功能图书馆的图书馆装上?
原标题:Why does the WPF designer fail to load libraries that call into unmanaged DLLs?

我正在使用2008年视觉演播室,NET 3.5 SP1,并使用以下模块进行测试:

  1. a C++ DLL
  2. a C++/CLI DLL that uses #1
  3. 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.

最佳回答

由于视觉演播室设计师把你的会议复制到一个临时地点,但并未复制你未管理的附属设施,你可以处理这个问题。

The simplest solution, although not ideal, is to add a folder that contains your unmanaged dependencies to the PATH environment variable, and then start DevEnv.exe with that PATH.

或者通过:

  • Adding the folder to the System environment variables using Computer -> Properties
  • Using a batch file that sets the path and then starts DevEnv

解决办法的问题在于,由于未管理的附属设施正在重建视力演播室,往往“被搁置”或不使用新内容,因此,在使用设计师适当彻底重建所有事物之后,你最终需要撤出和重新启用视力演播室,这可能是痛苦的。

问题回答

这不是一种真正的解决办法,但有时会有助于:使用“AnyCPU”(而不是“x64”)进行重建,因为设计者是一个32个轨道过程)和“释放”模式、近视力和重新开放的视觉演播室。 是的:这是非常令人厌恶的......





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签