// USE THIS FOR WPF
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
{
// in Visual Studio
}
else
{
// in the wild
}
// USE THIS FOR WINFORMS
bool isInFormsDesignerMode = (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv");
if (Process.GetCurrentProcess().ProcessName == "devenv")