Does VS have a 'if running in studio' flag?

  • Thread starter Thread starter foldface
  • Start date Start date
F

foldface

Hi
Sorry, don't know how to phrase the question any better.
Within Visual Studio I have a style sheet that being dynamically
added to the code, i.e. not via the html page. I want to place this
within
a html page so that the VS designer can see the style sheet but the
running
executable can't

#ifdef RUNNING_IN_VS
// include the style sheet
#endif

I also want to do the same thing within user controls. If their
running
in an executable I want them to do different things compared to if
their
having their properties examined via the call:

ComponentDesigner::InitializeInheritedProperties

I can think of contrived ways of doing this, having a UserControl
with a
property 'Running' which the executable sets but obviously VS won't
but I'd rather a cleaner way of doing it.


Thanks
F
 
F,

The way I would do this is check for HttpApplication.Context. This will be
null if you are in the designer.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
 
Foldface,

I haven't explicitly tested this in a static method, but I'm sure it will
work.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.


--------------------
 
I haven't explicitly tested this in a static method, but I'm sure it will

Sorry but how do you do this? Via Application["Context"]? That
doesn't seem to work? Can you give me just a quick noddy example,
about 3 lines worth?

Thanks

F
 
Yes, that's right. Sorry. I've been out of the office for several days.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
From: (e-mail address removed)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Re: Does VS have a 'if running in studio' flag?
Date: 11 Dec 2003 08:00:43 -0800
Organization: http://groups.google.com
Lines: 5
Message-ID: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
 
Back
Top