为什么当我们使用构建配置时,Expression Blend 4 的设计器不工作?

发布于 2024-09-08 03:09:27 字数 365 浏览 0 评论 0原文

我在使用 Expression Blend 4 时遇到了一个奇怪的问题。我已经将 Blend 4 与 Visual Studio 2010 结合使用相当长一段时间了,没有发生任何事故(除了超频繁的崩溃之外)。现在我们的图形设计师想要开始使用 Blend 来做一些修饰工作。

我们能够让 Blend 在他的计算机上编译解决方案。不幸的是,当我们尝试打开任何 XAML 文件时,设计器会出现错误,其中通过合并资源字典和附加属性包含的资源无法识别。基本上,即使 Blend 编译解决方案没有错误,也好像看不到构建工件。

我们的设置中唯一奇怪的是我们的解决方案包含多个构建配置,并且您无法在 Blend 中更改构建配置。

您认为 Blend 的设计器为何无法加载其构建的文件?

I'm having an odd issue with Expression Blend 4. I've been using Blend 4 in conjunction with Visual Studio 2010 for quite a while without incident (beyond the ultra-frequent crashes). Now our graphics designer wants to start using Blend to do some touch-up work.

We were able to get Blend to compile the solution on his computer. Unfortunately, when we try to open any XAML file, we get errors from the designer where resources included through the merged resource dictionary and attached properties are not recognized. Basically, it's as though the build artifacts aren't seen even though Blend is compiling the solution with no errors.

The only oddity in our setup is that our solution contains multiple build configurations, and you cannot change your build configuration in Blend.

Why do you suppose Blend's designer is failing to load the files that it built?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

土豪我们做朋友吧 2024-09-15 03:09:27

在弄清楚 Blend 4 如何构建 Visual Studio 项目/解决方案时,我发现了为什么我们的图形设计师的 Blend 副本无法正常工作并解决了问题。我们设置的多个构建配置是罪魁祸首。以下是我发现的具体情况,以及对其他使用多个构建配置、Blend 4 和 Visual Studio 2010 的人的警告列表。

警告 1:Blend 不允许您选择构建配置。

在 Visual Studio 中,当您构建时,您始终使用特定的构建配置进行构建。该设置可以更改。 Blend 似乎无法在其 UI 中的任何位置更改构建配置设置。相反,它使用自己的启发式方法来选择要使用的构建配置。

警告 2:Blend 在构建时不使用与设计时相同的逻辑来选择构建配置。

这就是给我们带来问题的原因。 Blend 似乎有两种不同的方式来选择构建配置。编译时,它使用 .csproj 文件中的逻辑来选择默认构建配置(请参阅警告 3)。然而,设计者会查看解决方案文件,以了解应使用哪个构建配置的输出目录来解析程序集引用(请参阅警告 4)。因此,尽管 Blend 编译正常,但设计者并没有查看编译后的文件,而是查看它创建的空 bin 目录。

警告 3:Blend 和 Visual Studio 处理默认构建配置的方式不同。

在 .csproj 文件的顶部,有一个属性组,用于指定在运行时未指定构建配置时要使用的构建配置csc.exe。 Visual Studio 似乎没有修改此数据,可能是因为它不需要它,因为它始终使用定义的构建配置。我们删除了默认的“调试”和“发布”配置,并制作了自己的“调试Windows”、“ReleaseWindows”、“调试Mac”和“ReleaseMac”配置,但项目文件在未指定配置时仍然表示使用“调试”。 Blend 4 在没有构建配置的情况下运行 csc.exe,因此使用默认逻辑。因此,我必须手动修复 .csproj 文件。

警告 4:Visual Studio 不允许您对解决方案的构建配置进行排序,并且排序与 Blend 相关。

与 Blend 在编译时选择构建配置的方式相反,Blend 的设计器似乎使用第一个 解决方案配置在解决方案文件中将项目与构建配置关联起来。然后,设计器在输出目录中查找其程序集的配置。换句话说,如果 .csproj 构建配置默认值与第一个解决方案配置的设置不匹配,即使您构建了项目,设计者也不会看到您的类、合并的资源字典等。

无论是第一个解决方案配置,都无法通过 Visual Studio 进行更改。为了修复设计人员寻找构建工件的位置,我们必须在 .sln 文件中手动重新排序解决方案配置。

In figuring out how Blend 4 builds Visual Studio projects/solutions, I found out why our graphics designer's copy of Blend was not working properly and fixed the problem. The multiple build configurations that we had set up were to blame. Here's the specifics of what I found out and a list of warnings to anyone else using multiple build configurations, Blend 4, and Visual Studio 2010.

Warning 1: Blend does not allow you to choose a build configuration.

In Visual Studio, when you build, you are always building with a specific build configuration. This setting can be changed. Blend doesn't appear to have the ability to change the build configuration setting anywhere in its UI. Instead, it uses its own heuristics for selecting which build configuration to use.

Warning 2: Blend does not use the same logic for selecting a build configuration when building as it does when designing.

This is what was causing issues for us. It seems that Blend has two different ways to choose a build configuration. When you compile, it uses the logic in the .csproj files for selecting a default build configuration (see warning 3). The designer, however, looks to the solution file for which build configuration's output directory it should use to resolve assembly references (see warning 4). So although Blend was compiling alright, the designer was not looking at the compiled files but at an empty bin directory it created.

Warning 3: Blend and Visual Studio do not handle default build configurations the same way.

At the top of .csproj files, there's a property group that specifies which build configuration to use when one is not specified when running csc.exe. Visual Studio does not seem to modify this data, probably because it doesn't need it given that it always uses a defined build configuration. We had removed the default Debug and Release configurations and made our own DebugWindows, ReleaseWindows, DebugMac, and ReleaseMac configurations, but the project files still said to use "Debug" when no configuration is specified. Blend 4 runs csc.exe with no build configuration, so the defaulting logic is used. Therefore, I had to manually fix up the .csproj files.

Warning 4: Visual Studio does not allow you to order your solution's build configurations, and the ordering is relevant to Blend.

Contrary to how Blend selects build configurations when compiling, Blend's designer seems to use the first solution configuration in a solution file to associate projects with a build configuration. The designer then looks to the output directory for that configuration for its assemblies. In other words, if there's a mismatch between the .csproj build configuration defaults and the first-solution-configuration's settings, the designer will not see your classes, merged resource dictionaries, etc, even if you built the project.

Whichever solution configuration is first cannot be changed through Visual Studio. For us to fix where the designer looked for build artifacts, we had to reorder the solution configurations manually in the .sln file.

南…巷孤猫 2024-09-15 03:09:27

您还可以通过将调试配置添加回解决方案来快速解决此问题:

创建另一个名为“调试”的配置,将其放在配置列表的第一位。

在此处输入图像描述

您可以通过两种方式执行此操作:
1) 将已存在的配置重命名为“调试”
- 打开配置管理器
- 展开“活动解决方案配置”下拉列表
- 选择后您可以编辑或删除任何现有配置。
2) 添加新配置。
- 按照上面的说明进行操作,然后
- 您将需要手动重新排序解决方案文件中的配置。

希望这有帮助...

You can also quickly solve this issue by adding a Debug config back into your solution:

Create another Configuration called 'Debug' placed first in the list of configurations.

enter image description here

You can do this in two ways:
1) Rename an already present configuration to 'Debug'
- Open the Configuration manager
- Expand the 'Active solution configeration' dropdown
- select and you can edit or delete any of the configurations present.
2) Add a new configuration.
- Follow instructions above, and then
- You will need to reorder the configurations in your solution file manually.

Hope this helps...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文