I need a .ASPX file to behave differently based on a conditional compilation symbol.
Say as a simple example:
<%@ Control Language="C#" AutoEventWireup="true" (...) %> <% #ifdef DEBUG %> <asp:SomeDebugControlHere runat="server"/> .. well .. a LOT of code here <% #else %> <asp:SomeReleaseControlHere runat="server"/> .. and a LOT of other code here <% #endif %>
Later Edit : A few more clarifications. The problem is that the SomeDebugControlHere class is not even defined in the release build (it is more complex in real life, but it is carried in this example). So in the page.aspx.designer.cs file, I need to get this in the debug assembly:
/// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.SomeDebugControlHere myControl
and this is in the release build: (and never both)
/// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.SomeReleaseControlHere myControl
Obviously, I need markup in the .aspx file to be different, but I need the designer.cs file to be modified to include new objects / classes as well.
I just hope someone knows of a smart way to do this, either with some kind of control inheritance, or something that will allow me to specify different control classes depending on the compilation build settings.
source share