问题
I am having a frustrating time with Blend reporting "Window is not supported in a Windows Presentation Foundation (WPF) project." due to unbuildable configurations but can't quite work out how to mangle my way out of it.
I've worked out it is probably due to my trying to have a single solution with x86 and x64 configurations. There is no way to tell Blend 2 which is the active Solution Configuration and active Solution Platform.
I think it's a bit of a weakness in the configuration system, or maybe the way I've set things up, but I have Debug64 and Debug solution configurations one of each is used with the platform x86 and x64.
I also think it's a simple sorting problem - x64 comes before x86 and Debug comes before Debug64 so Blend ends up with an unbuildable config of Debug with x64.
When I choose the combination of Debug and x64 in VS, its XAML editor can't load either.
The solution is a moderately complex one - there's a pure Win32 DLL, C++/CLI Model project and two other WPF assemblies used by the main WPF project.
UPDATE I have ripped all the x64 config out of my solution and rebuilt everything with no effect.
I then uninstalled Blend 2 and installed Blend 3 - it doesn't like things either.
The Visual Studio XAML editor is still very happy as is the program building and running.
(echoes of strangled scream of frustration from oz)
回答1:
Blend requires the solution to ALSO have an AnyCPU platform in the configuration manager.
Any C++ (including C++/CLI) projects in the solution will not be loaded.
I have AnyCPU +x86 +x64 platforms in my solutions, the AnyCPU doesn't build non C# projects.
Put the windows/controls in AnyCPU C# dlls, so they can be edited in blend.
(Do not reference x86/x64 projects from them.)
Set the exe as x86 and x64 only (no AnyCPU) - will not run in blend (no AnyCPU), but the solution will still build.
回答2:
There are also a few other reasons this could happen:
1) Missing references. Add a reference to PresentationCore, PresentationFramework, and WindowsBase
It could also be looking for .dlls from the wrong platform. I just solved my problem by making the following change:
In the .csproj file in question, change this line
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
To
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
回答3:
I came across this issue with VS2010 and Blend4. Suddenly my project would not render in Blend.
The issue was that a developer on our team setup Custom Build Configurations. When he did this he removed Debug. Once i added Debug back to the build configuration Blend was happy again.
回答4:
On my side, I solved the problem this way:
- the AnyCPU trick (but not enough...)
- Unload project, edit project file, look at 4.0 framework references and change them to 4.5 (target and minial required version).
rebuild solution, then Blend Preview for WPF 4.5 stopped to show the error messsage (window is not supported...).
Thanks all for putting me on the track !
来源:https://stackoverflow.com/questions/2174621/blend-window-is-not-supported-in-a-wpf-project