How to determine development time in a VS.NET 2003 library project

The code below does not work as expected to determine if it is in development mode (VS.Net 2003 - Control Library):

if (this.Site! = null && this.Site.DesignMode == true)
{
// Development mode
}
else
{
// Runtime
}

It is used in a complex user control obtained from another user control and including other user controls. Is there any other way to determine development time in VS.NET 2003 or what is the problem with the code above?

+3
source share
2 answers

DesignMode . ( , 1.1):

if (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime)

GetService(typeof(IDesignerHost)) , -.

.

+6

, HttpContext.Current == null, http://west-wind.com/weblog/posts/189.aspx

.Net 2.0 Control.DesignMode(http://msdn.microsoft.com/en-us/library/system.web.ui.control.designmode.aspx). , VS 2003, , , .

. Winforms, Component.DesignMode(http://msdn.microsoft.com/en-us/library/system.componentmodel.component.designmode.aspx) - . , this.Site.DesignMode , Component.DesignMode , , (Site!= Null && Site.DesignMode).

, , Site?

0

Source: https://habr.com/ru/post/1697619/


All Articles