• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 849
  • Last Modified:

How to distinguish design time from run-time?

I am using the code below, but I want to know is there a better way to check if I am in design time?
if( System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv" )
			{
				return;
			}

Open in new window

0
HOVE
Asked:
HOVE
  • 2
1 Solution
 
aherpsCommented:
From:http://vidmar.net/weblog/archive/2005/04/11/1246.aspx

1.) Call GetService(typeof(IDesignerHost)) and see if it returns something.

2.) System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Nevermind...I misread the question.   =\
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now