microsoft/winforms-designer-extensibility

How to avoid conditional compilation when using Designer attribute?

Opened this issue · 0 comments

He @KlausLoeffelmann

I have a component which requires both net462 and .NET design time support, so i have created stub RootDesigners for net462 and .NET, but i cant apply them without conditionall compilation

The following line seems to work only for net462 environment.
[Designer("Server.CompoundObjectRootDesigner", typeof(IRootDesigner)), ToolboxItem(false)]

In .NET environment it leads to the following error:
image

So for .NET i have to use this, but it will not work in net462 environment:
[Designer("CompoundObjectRootDesigner", typeof(IRootDesigner)), ToolboxItem(false)]

Is it possible to support same convention for both targets? Or is conditional compilation the recommended approach:
#if NET462
[Designer("Server.CompoundObjectRootDesigner", typeof(IRootDesigner)),
ToolboxItem(false)]
#else
[Designer("CompoundObjectRootDesigner", typeof(IRootDesigner)),
ToolboxItem(false)]
#endif

Thanks