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

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
 
J

Jim Cheshire [MSFT]

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.

--------------------
 
J

Jim Cheshire [MSFT]

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.


--------------------
 
F

foldface

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
 
J

Jim Cheshire [MSFT]

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]>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top