在XAML中的3.5和4.0命名空间之间切换 [英] Switching between 3.5 and 4.0 namespaces in XAML
问题描述
我们有一个单一的源库,我们希望使用2个项目文件针对3.5和4.0进行编译.我们使用#if在CS中的3.5和4.0之间切换.
We have a single source base which we want to compile against 3.5 and 4.0 - using 2 project files. We use #if to switch between 3.5 and 4.0 in CS.
我们如何在XAML中做同样的事情?因为我们要在3.5中进行切换:
How do we do the same in XAML? Because we want to switch between this in 3.5:
xmlns vsm
and this in 4.0:
xmlns:vsm="clr-namespace:System.Windows;assembly=PresentationFramework"
谢谢
推荐答案
您可以通过程序集级属性处理的条件包含来完成此操作.
You can do this via conditional includes handled via assembly level attributes.
有关详细信息,请参见以下文章: http://www.removingalldoubt. com/PermaLink.aspx/defa2a7d-b1e9-49eb-b8c8-438348be8d18
For details, see this post: http://www.removingalldoubt.com/PermaLink.aspx/defa2a7d-b1e9-49eb-b8c8-438348be8d18
只需在项目中设置带有定义集的装配体属性即可在两个版本之间进行切换.
Just setup assembly attributes with a define set in your project to switch between the two versions.
这篇关于在XAML中的3.5和4.0命名空间之间切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!