x64 中的 Visual Studio 设计器不起作用 [英] Visual Studio designer in x64 doesn't work

查看:69
本文介绍了x64 中的 Visual Studio 设计器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio 2010 64 位中,我无法设计表单.
我不断收到此警告(和错误):

In Visual Studio 2010 64bit I can't design my forms.
I keep getting this warning (and error):

Warning 18  
The designer could not be shown for this file because none of the classes within it can be designed.  The designer inspected the following classes in the file: 
MainForm --- The base class 'Blah' could not be loaded.  Ensure the assembly has been referenced and that all projects have been built.

这只发生在我为 x64 编译时……在 x86 中,设计器运行良好.

This only happens with when I compile for x64 ... in x86 the designer works well.

只是想明确一点,我需要该项目在 x64 上运行,因为该项目的很多组件都是在 x64 中编译的,如果表单在 x86 中将无法运行.

Just want to be clear that I NEED the project to work on x64 because a lot of the project's components are compiled in x64 and won't work if the forms are in x86.

有没有其他人遇到过这种情况并找到了解决方案?

Has anyone else encountered this and found a solution ?

推荐答案

我可以通过创建一个带有用户控件的 WPF 应用程序来重现您的问题(将用户控件放在 wpf 应用程序上,并构建 x64).

I can repro your problem by creating a WPF application with a user control (put the user control on the wpf app, and build x64).

这是我对正在发生的事情的猜测:

Here's my guess as to what's going on:

Visual Studio 是一个 32 位应用程序,WPF 设计器必须加载引用的程序集(当您使用用户控件时,您总是会看到这种行为,您必须重新构建以更新设计器).Windows 不支持在 32 位和 64 位之间共享 - 您必须拥有 32 位应用或 64 位应用,期间,不共享.

Visual Studio is a 32-bit application and the WPF designer has to load referenced assemblies (you see that behavior all of the time when you use user controls, where you have to rebuild to get the designer to update). Windows does not support a sharing between 32-bit and 64-bit - you have to have either a 32 bit app or a 64-bit app, period, no sharing.

由于 WPF 设计器是 32 位的,因此程序集需要是 32 位的.

Since the WPF designer is 32-bit, the assemblies need to be 32 bit.

这是一个可能的解决方案:

Here is a possible solution:

使用任何 CPU"选项设计您的应用.这将导致您的代码在 32 位平台上 JIT 为 32 位,而在 64 位平台上为 64 位.

Design your app with the "Any CPU" option. This will cause your code to JIT to 32-bit on 32-bit platforms and 64-bit on 64-bit platforms.

  • 设计人员将在任何 CPU"下工作,因为程序集会被 jitt 到 32 位.
  • 当您需要专门调试 64 位时,请将您的构建配置切换到 64 位(知道您必须切换回32 位"或任何 cpu"进行表单设计)

这篇关于x64 中的 Visual Studio 设计器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆