Using Visual Studio 2012 Web Publish For Staging On The Internet


Let’s say you have a production code like and you want to have a test site on the internet that will not be seen by anyone unless they login (or maybe even login as an admin).  Using web.config (with Visual Studio 2012), transformations makes that very straight forward.  I know because I just did that.  I created a test site (say: and set up my publish to replace my normal anonymous authentication (allowing anonymous users) to one that denies anonymous users.  Just as an aside, the reason I did this was I notice that google was indexing some of those pages even though my robots.txt file says to deny access to all robots.  Apparently some crawlers don’t respect that signal.

For a little background, I did publish some basics about doing transforms here:

So, here is what I have in my web.config file that is part of my normal project source control.


And, here is my transform file (Web.Test.config)


And, just to show the result, this is what end up on my test server:


And Finally, just for some extra bonus stuff here at the end, here is what my tranformation looks like that simply removes the debug option when I publish to production.


About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP since 2007. In addition, he’s a multi-course video author at Pluralsight. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


  1. […] Using Visual Studio 2012 Web Publish For Staging On The Internet – Peter Kellner […]


Get every new post delivered to your Inbox

Join other followers: