Configuration and Environment Variables - Visual Studio 2010
How to create configuration or Environment variables in Visual Studio 2010.
Environment variables are a great thing for when you publish your website to multiple places.
It doesn't matter if you publish it to testing / staging / production environment or if you're publishing your site to several servers which require different methods to be called / different values assigned to parameters.
Lets create a web application project (further explanations will be granted later)
As you can see, you automatically have two configuration options:
Click on Properties.
Click on Build tab.
Under that tab you have many configuration options (which will be discussed in another post).
The field we're interested in is "Conditional compilation symbols".
While on Debug mode, we will write a variable name in this field.
Example: "vDebug"
After saving, you will have an identifier for when in Debug mode.
Before testing our work, we're gonna create another Configuration.
Click on the configuration drop down list and choose Configuration Manager
Add new Configuration - TestRelease:
Now place the variables in Release Configuration and in TestRelease Configuration.
I've placed the variables: vRelease and vTestRelease
Now for the test.
Create a similar code on your Default.aspx.cs page:
When you will run the code, you'll see that for each configuration option it will it the correct method.
Hope it helped,
Elad Shalom,
CTO at ITweetLive.com
Environment variables are a great thing for when you publish your website to multiple places.
It doesn't matter if you publish it to testing / staging / production environment or if you're publishing your site to several servers which require different methods to be called / different values assigned to parameters.
Lets create a web application project (further explanations will be granted later)
- Open Visual Studio 2010
- Create New Project -> ASP.NET Web Application
As you can see, you automatically have two configuration options:
- Debug
- Release
Click on Properties.
Click on Build tab.
Under that tab you have many configuration options (which will be discussed in another post).
The field we're interested in is "Conditional compilation symbols".
While on Debug mode, we will write a variable name in this field.
Example: "vDebug"
After saving, you will have an identifier for when in Debug mode.
Before testing our work, we're gonna create another Configuration.
Click on the configuration drop down list and choose Configuration Manager
Add new Configuration - TestRelease:
Now place the variables in Release Configuration and in TestRelease Configuration.
I've placed the variables: vRelease and vTestRelease
Now for the test.
Create a similar code on your Default.aspx.cs page:
When you will run the code, you'll see that for each configuration option it will it the correct method.
Hope it helped,
Elad Shalom,
CTO at ITweetLive.com
I am truly delighted to read this webpage posts which consists of plenty of helpful information, thanks for providing these data.
ReplyDeleteMy website: kataskevi istoselidwn
Appreciate the recommendation. Let me try it out.
ReplyDeleteVisit my web blog - click here to read this message
Hi there, I log on to your new stuff like every week.
ReplyDeleteYour writing style is witty, keep up the good work!
Feel free to visit my site ; my article tools
Thanks for the clear and concise example. I had been searching for a bit before I stumbled on this perfectly presented explanation.
ReplyDeletejianbin0623
ReplyDeletepolo shirts
rolex watches
christian louboutin uk
kate spade uk
ferragamo shoes
nike air max 90
michael kors outlet online
jordan shoes 2015
fitflops clearance
toms outlet
cheap oakley sunglasses
true religion outlet
ralph lauren polo shirts
tiffany and co
basketball shoes,basketball sneakers,lebron james shoes,sports shoes,kobe bryant shoes,kobe sneakers,nike basketball shoes,running shoes,mens sport shoes,nike shoes
michael kors outlet uk
ralph lauren pas cher
louis vuitton outlet
ferragamo outlet
swarovski crystal
omega outlet
coach outlet online
polo ralph lauren outlet
kate spade handbags
coach outlet store
michael kors outlet
michael kors handbags
gucci sunglasses
rolex watches
mont blanc pens
celine outlet online
nike huarache
tiffany and co
oakley sunglasses wholesale
ghd uk
swarovski crystal
fitflops shoes
ReplyDeletelongchamp uk
new balance shoes
fitflops
mont blanc pens outlet
louis vuitton handbags
rolex watches
michael kors canada
ghd hair dryer
cheap oakleys
birkenstock shoes
ralph lauren uk
kobe bryant shoes
kate spade bags
ed hardy
louis vuitton outlet online
north face uk
tiffany and co outlet
kate spade outlet online
coach factory outlet
coach outlet online
tory burch outlet online
canada goose outlet
coach outlet online
canada goose jackets
nike tn pas cher
pandora charms outlet
michael kors purses
true religion jeans outlet
michael kors handbags outlet
coach factory outlet online
cartier love ring
birkenstocks
20160723caiyan
cheap oakleys
ReplyDeletelongchamp handbags
cheap mlb jerseys
coach outlet
cheap mlb jerseys
michael kors outlet online
ugg outlet
lacoste shoes
nike free flyknit
longchamp uk
20161021caiyan
louis vuitton handbags
ReplyDeletetoms outlet
ralph lauren outlet
ugg australia
longchamp outlet
polo ralph lauren outlet online
uggs outlet
nfl jerseys
rolex daytona
red bottoms shoes
20161117caiyan
dolce and gabbana shoes
ReplyDeletenike trainers uk
ralph lauren outlet
sac longchamp
adidas nmd runner
chicago bulls jersey
detroit lions jerseys
reebok outlet
michael kors handbags
christian louboutin shoes
jordan 6
ReplyDeleteferragamo belt
adidas ultra boost
yeezy boost 700
kd shoes
adidas nmd
lacoste polo
lacoste polo shirts
golden goose sneakers
nike sneakers for women
Thank you for sharing the information. See also information from us through the following article! Thank you :)
ReplyDeleteObat Tetes Infeksi Telinga
Cara Mengatasi Sakit Tenggorokan Susah Menelan
Obat TBC Kelenjar Alami
This article will hopefully help and benefit us all
ReplyDeleteObat Penyakit Insomnia
Cara Alami Untuk Mengobati Batuk Kronis
Cara Mengobati Penyakit Usus Buntu
Cara Mengobati Mata Merah Berlendir
Obat Untuk Penyakit TBC
Cara Pemesanan QnC Jelly Gamat
ysl handbags
ReplyDeletejordans
air max 270
hogan outlet online
michael kors outlet
michael kors bags
nike air huarache
russell westbrook shoes
yeezy 500
nike jordans