<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>LifeCycle Solutions, LLC - Weblog - Visual Studio</title>
    <link>http://blog.lifecycle-solutions.com/</link>
    <description>Technical Writing</description>
    <language>en-us</language>
    <copyright>LifeCycle Solutions, LLC</copyright>
    <lastBuildDate>Thu, 26 Feb 2009 23:27:30 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>info@lifecycle-solutions.com</managingEditor>
    <webMaster>info@lifecycle-solutions.com</webMaster>
    <item>
      <trackback:ping>http://blog.lifecycle-solutions.com/Trackback.aspx?guid=881a0cb7-695e-4842-9637-b40c8051106a</trackback:ping>
      <pingback:server>http://blog.lifecycle-solutions.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.lifecycle-solutions.com/PermaLink,guid,881a0cb7-695e-4842-9637-b40c8051106a.aspx</pingback:target>
      <dc:creator>Daniel Root</dc:creator>
      <wfw:comment>http://blog.lifecycle-solutions.com/CommentView,guid,881a0cb7-695e-4842-9637-b40c8051106a.aspx</wfw:comment>
      <wfw:commentRss>http://blog.lifecycle-solutions.com/SyndicationService.asmx/GetEntryCommentsRss?guid=881a0cb7-695e-4842-9637-b40c8051106a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've recently started playing with NDepend again.  This tool is a sort of data
mining utility for your code.  Feed it your assemblies and it can tell you almost
anything about them.  Using a custom query language with a SQL-like syntax, you
can dig into all sorts of metrics and useful information. Out of the box, it ships
with tons of useful queries for common code problems.  
</p>
        <p>
I ran some of our code through it and got dinged on some of the code complexity queries:
</p>
        <p>
 <a href="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="187" alt="image" src="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_thumb.png" width="430" border="0" /></a></p>
        <p>
In this case, I had several huge methods that needed to be broken up and optimized. 
Thanks to NDepend's prodding, I spent some time refactoring using ReSharper, and whittled
those down to 0s:
</p>
        <p>
          <a href="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_4.png">
          </a>
          <a href="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_8.png">
            <img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="142" alt="image" src="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_thumb_3.png" width="405" border="0" />
          </a>
        </p>
        <p>
That's helpful, but not nearly everything that NDepend can do.  For example,
the code I'm testing with is involved in some multithreading, so with a little digging
through the docs, I came up with this query to show all methods that change state
(besides property and event setters), but don't use any locks:
</p>
        <p>
WARN IF Count &lt; 0 IN SELECT METHODS WHERE 
<br />
!IsDirectlyUsing "System.Threading.Monitor" AND ( ChangesObjectState OR
ChangesTypeState ) AND 
<br />
!IsConstructor AND !IsClassConstructor AND !IsPropertySetter AND !IsEventAdder AND
!IsEventRemover
</p>
        <p>
This doesn't guarantee thread-safe code, but it definitely helps drill down to potential
problem areas.
</p>
        <p>
Another area I can see us using this in is to provide metrics for our customers. 
Generally they are not concerned with things like Cyclomatic Complexity, but some
simple numbers may be useful.  We use FinalBuilder, so it's possible we could
run NDepend's console utility to roll the numbers into some XML and publish to their
customer wiki.  For example, here's a quick query to spit out the total number
of tests for a project:
</p>
        <p>
SELECT METHODS FROM ASSEMBLIES "TestAssemblyName" WHERE HasAttribute "NUnit.Framework.TestAttribute"
</p>
        <p>
Once we get a customer set up with these metrics, we'll post more about how to automate
that.  Until then, go <a href="http://www.ndepend.com">check out NDepend</a>!
</p>
        <p>
        </p>
        <img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=881a0cb7-695e-4842-9637-b40c8051106a" />
      </body>
      <title>DeepZoom Your Code Quality With NDepend</title>
      <guid isPermaLink="false">http://blog.lifecycle-solutions.com/PermaLink,guid,881a0cb7-695e-4842-9637-b40c8051106a.aspx</guid>
      <link>http://blog.lifecycle-solutions.com/2009/02/26/DeepZoomYourCodeQualityWithNDepend.aspx</link>
      <pubDate>Thu, 26 Feb 2009 23:27:30 GMT</pubDate>
      <description>&lt;p&gt;
I've recently started playing with NDepend again.&amp;#160; This tool is a sort of data
mining utility for your code.&amp;#160; Feed it your assemblies and it can tell you almost
anything about them.&amp;#160; Using a custom query language with a SQL-like syntax, you
can dig into all sorts of metrics and useful information. Out of the box, it ships
with tons of useful queries for common code problems.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
I ran some of our code through it and got dinged on some of the code complexity queries:
&lt;/p&gt;
&lt;p&gt;
&amp;#160;&lt;a href="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="187" alt="image" src="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_thumb.png" width="430" border="0" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
In this case, I had several huge methods that needed to be broken up and optimized.&amp;#160;
Thanks to NDepend's prodding, I spent some time refactoring using ReSharper, and whittled
those down to 0s:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_4.png"&gt;&lt;/a&gt;&lt;a href="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_8.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="142" alt="image" src="http://blog.lifecycle-solutions.com/content/binary/WindowsLiveWriter/DeepZoomYourCodeQualityWithNDepend_C61E/image_thumb_3.png" width="405" border="0" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
That's helpful, but not nearly everything that NDepend can do.&amp;#160; For example,
the code I'm testing with is involved in some multithreading, so with a little digging
through the docs, I came up with this query to show all methods that change state
(besides property and event setters), but don't use any locks:
&lt;/p&gt;
&lt;p&gt;
WARN IF Count &amp;lt; 0 IN SELECT METHODS WHERE 
&lt;br /&gt;
!IsDirectlyUsing &amp;quot;System.Threading.Monitor&amp;quot; AND ( ChangesObjectState OR
ChangesTypeState ) AND 
&lt;br /&gt;
!IsConstructor AND !IsClassConstructor AND !IsPropertySetter AND !IsEventAdder AND
!IsEventRemover
&lt;/p&gt;
&lt;p&gt;
This doesn't guarantee thread-safe code, but it definitely helps drill down to potential
problem areas.
&lt;/p&gt;
&lt;p&gt;
Another area I can see us using this in is to provide metrics for our customers.&amp;#160;
Generally they are not concerned with things like Cyclomatic Complexity, but some
simple numbers may be useful.&amp;#160; We use FinalBuilder, so it's possible we could
run NDepend's console utility to roll the numbers into some XML and publish to their
customer wiki.&amp;#160; For example, here's a quick query to spit out the total number
of tests for a project:
&lt;/p&gt;
&lt;p&gt;
SELECT METHODS FROM ASSEMBLIES &amp;quot;TestAssemblyName&amp;quot; WHERE HasAttribute &amp;quot;NUnit.Framework.TestAttribute&amp;quot;
&lt;/p&gt;
&lt;p&gt;
Once we get a customer set up with these metrics, we'll post more about how to automate
that.&amp;#160; Until then, go &lt;a href="http://www.ndepend.com"&gt;check out NDepend&lt;/a&gt;!
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&gt;&gt;&lt;img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=881a0cb7-695e-4842-9637-b40c8051106a" /&gt;</description>
      <comments>http://blog.lifecycle-solutions.com/CommentView,guid,881a0cb7-695e-4842-9637-b40c8051106a.aspx</comments>
      <category>C#</category>
      <category>Utilities</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://blog.lifecycle-solutions.com/Trackback.aspx?guid=95f12740-fa71-45b5-ae6a-25480d90b0c9</trackback:ping>
      <pingback:server>http://blog.lifecycle-solutions.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.lifecycle-solutions.com/PermaLink,guid,95f12740-fa71-45b5-ae6a-25480d90b0c9.aspx</pingback:target>
      <dc:creator>Daniel Root</dc:creator>
      <wfw:comment>http://blog.lifecycle-solutions.com/CommentView,guid,95f12740-fa71-45b5-ae6a-25480d90b0c9.aspx</wfw:comment>
      <wfw:commentRss>http://blog.lifecycle-solutions.com/SyndicationService.asmx/GetEntryCommentsRss?guid=95f12740-fa71-45b5-ae6a-25480d90b0c9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the challenges of being a contract software developer is that we often work
remotely on a clients' network via VPN.  Each client has their own VPN client,
Source Control, and development environments.  In many cases, development platforms
just aren't made with this in mind.  It's only as of VS 2005 that you can even
switch Source Control Providers easily! If you've ever had to connect to Microsoft
SourceSafe over VPN, you know it's still not designed with remote work in mind. 
It relies on a network file share, which can be problematic over VPN.  It does
ship with a WebService based solution, but this may not be feasible for the client
to install in all cases. 
</p>
        <p>
          <strong>The Problem</strong>
        </p>
        <p>
When connecting over VPN, the main problem is that there is no option to specify the
network user to connect with.  For example, you may log in to the clients' VPN,
but still attempt to access resources using your machine's local account.  When
doing things like mapping drives, it's easy to supply an alternate username and password. 
However, with SourceSafe, there is no option to supply network credentials when connecting
(which are totally different from the SourceSafe credentials).
</p>
        <p>
          <strong>The Solution</strong>
        </p>
        <p>
Enter the Windows runas command.  This command lets you run any application as
though it were a different user.  In this case, you want to run Visual Studio
as though you were that network user.  To set this up:
</p>
        <ul>
          <li>
Create an empty text file named "RunVisualStudioAs[DomainUserName].bat"</li>
          <li>
Edit and Add the following:</li>
          <ul>
            <li>
runas /netonly /user:[Domain]\[User] "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"</li>
          </ul>
          <li>
Save.</li>
        </ul>
        <p>
Then, when working on the project, just launch VS using the batch file.  You
will be prompted for a password each time, since runas does not allow entering a password
in the commandline for obvious security reasons.  But there are 3rd party runas
replacements which can help you get around this.
</p>
        <p>
One other word of caution:  Due to the chatty nature of Windows file sharing,
this will still be <em><u>very</u></em> slow over a remote connection.  Turning
off Anti-Virus helps a little, and there are some <a href="http://www.cjcraft.com/blog/CommentView,guid,9a22bcff-18d6-431f-a4c9-1b9d7f0c34ad.aspx">additional
speed tips here</a>. It's definitely not the ideal solution, but it can be done!
</p>
        <img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=95f12740-fa71-45b5-ae6a-25480d90b0c9" />
      </body>
      <title>How To: Connect to Microsoft SourceSafe over VPN</title>
      <guid isPermaLink="false">http://blog.lifecycle-solutions.com/PermaLink,guid,95f12740-fa71-45b5-ae6a-25480d90b0c9.aspx</guid>
      <link>http://blog.lifecycle-solutions.com/2008/02/21/HowToConnectToMicrosoftSourceSafeOverVPN.aspx</link>
      <pubDate>Thu, 21 Feb 2008 16:15:22 GMT</pubDate>
      <description>&lt;p&gt;
One of the challenges of being a contract software developer is that we often work
remotely on a clients' network via VPN.&amp;nbsp; Each client has their own VPN client,
Source Control, and development environments.&amp;nbsp; In many cases, development platforms
just aren't made with this in mind.&amp;nbsp; It's only as of VS 2005 that you can even
switch Source Control Providers easily! If you've ever had to connect to Microsoft
SourceSafe over VPN, you know it's still not designed with remote work in mind.&amp;nbsp;
It relies on a network file share, which can be problematic over VPN.&amp;nbsp; It does
ship with a WebService based solution, but this may not be feasible for the client
to install in all cases. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The Problem&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
When connecting over VPN, the main problem is that there is no option to specify the
network user to connect with.&amp;nbsp; For example, you may log in to the clients' VPN,
but still attempt to access resources using your machine's local account.&amp;nbsp; When
doing things like mapping drives, it's easy to supply an alternate username and password.&amp;nbsp;
However, with SourceSafe, there is no option to supply network credentials when connecting
(which are totally different from the SourceSafe credentials).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The Solution&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Enter the Windows runas command.&amp;nbsp; This command lets you run any application as
though it were a different user.&amp;nbsp; In this case, you want to run Visual Studio
as though you were that network user.&amp;nbsp; To set this up:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Create an empty text file named "RunVisualStudioAs[DomainUserName].bat"&lt;/li&gt;
&lt;li&gt;
Edit and Add the following:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
runas /netonly /user:[Domain]\[User] "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Save.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Then, when working on the project, just launch VS using the batch file.&amp;nbsp; You
will be prompted for a password each time, since runas does not allow entering a password
in the commandline for obvious security reasons.&amp;nbsp; But there are 3rd party runas
replacements which can help you get around this.
&lt;/p&gt;
&lt;p&gt;
One other word of caution:&amp;nbsp; Due to the chatty nature of Windows file sharing,
this will still be &lt;em&gt;&lt;u&gt;very&lt;/u&gt;&lt;/em&gt; slow over a remote connection.&amp;nbsp; Turning
off Anti-Virus helps a little, and there are some &lt;a href="http://www.cjcraft.com/blog/CommentView,guid,9a22bcff-18d6-431f-a4c9-1b9d7f0c34ad.aspx"&gt;additional
speed tips here&lt;/a&gt;. It's definitely not the ideal solution, but it can be done!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=95f12740-fa71-45b5-ae6a-25480d90b0c9" /&gt;</description>
      <comments>http://blog.lifecycle-solutions.com/CommentView,guid,95f12740-fa71-45b5-ae6a-25480d90b0c9.aspx</comments>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://blog.lifecycle-solutions.com/Trackback.aspx?guid=c2a3cfa6-65b1-41bd-ad00-c928e9d55ec0</trackback:ping>
      <pingback:server>http://blog.lifecycle-solutions.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.lifecycle-solutions.com/PermaLink,guid,c2a3cfa6-65b1-41bd-ad00-c928e9d55ec0.aspx</pingback:target>
      <dc:creator>Yohan Pamudji</dc:creator>
      <wfw:comment>http://blog.lifecycle-solutions.com/CommentView,guid,c2a3cfa6-65b1-41bd-ad00-c928e9d55ec0.aspx</wfw:comment>
      <wfw:commentRss>http://blog.lifecycle-solutions.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c2a3cfa6-65b1-41bd-ad00-c928e9d55ec0</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For one of our clients, I've been working on converting printed forms into web forms,
and in the process have been dealing with a lot of tables that need to fit within
a fixed width.  These tables are in a FormView in a User Control, which are
then placed on webpages as needed.  I was finding that Visual Studio 2008's
design mode was happy enough to accept my fixed-width columns and tables settings
in my CSS stylesheet when working on the User Control, but once that User Control
is placed on an actual page the fixed-width settings are no longer respected in both
design mode and in debug mode displayed through a browser.  What to do? 
After much frustration I found the embarrasingly simple answer: I wasn't putting "px"
at the end of pixel measurements for table/column widths.  For whatever reason
the Visual Studio 2008 FormView designer was content without the "px" but nothing
else was.  In my rush to get things working I was leaving off the "px" figuring
that I could go back later and add them on after the fact.  So lesson learned:
be standards compliant, even if your development tool of choice lets you get away
with not being standards compliant.
</p>
        <p>
Still on the topic of fixed-width tables and columns, have you ever wanted to figure
out exactly how many pixels wide/tall something is on a webpage, be it a table row,
table column, header graphic, etc.?  Enter <a href="http://www.mioplanet.com/products/pixelruler/index.htm">Pixel
Ruler</a>--a free app that displays a rotatable ruler on your screen and even tracks
your mouse cursor and keeps a running measurement of how many pixels away you are
from the zero mark on the ruler (in one dimension of course--it doesn't do diagonal
measurements).  This app will save me countless hours of eyeballing and hoping
for the best, instead providing me with precise measurements to the pixel.
</p>
        <img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=c2a3cfa6-65b1-41bd-ad00-c928e9d55ec0" />
      </body>
      <title>Having trouble with fixed-width tables?  Two helpful hints.</title>
      <guid isPermaLink="false">http://blog.lifecycle-solutions.com/PermaLink,guid,c2a3cfa6-65b1-41bd-ad00-c928e9d55ec0.aspx</guid>
      <link>http://blog.lifecycle-solutions.com/2008/02/14/HavingTroubleWithFixedwidthTablesTwoHelpfulHints.aspx</link>
      <pubDate>Thu, 14 Feb 2008 18:36:31 GMT</pubDate>
      <description>&lt;p&gt;
For one of our clients, I've been working on converting printed forms into web forms,
and in the process have been dealing with a lot of tables that need to fit within
a fixed width.&amp;nbsp; These tables are in a FormView in a User Control, which&amp;nbsp;are
then placed&amp;nbsp;on webpages as needed.&amp;nbsp; I was finding that Visual Studio 2008's
design mode was happy enough to accept my fixed-width columns and tables settings
in my CSS stylesheet when working on the User Control, but once that User Control
is placed on an actual page the fixed-width settings are no longer respected in both
design mode and in debug mode displayed through a browser.&amp;nbsp; What to do?&amp;nbsp;
After much frustration I found the embarrasingly simple answer: I wasn't putting "px"
at the end of pixel measurements for table/column widths.&amp;nbsp; For whatever reason
the Visual Studio 2008 FormView designer was content without the "px" but nothing
else was.&amp;nbsp; In my rush to get things working I was leaving off the "px" figuring
that I could go back later and add them on after the fact.&amp;nbsp; So lesson learned:
be standards compliant, even if your development tool of choice lets you get away
with not being standards compliant.
&lt;/p&gt;
&lt;p&gt;
Still on the topic of fixed-width tables and columns, have you ever wanted to figure
out exactly how many pixels wide/tall something is on a webpage, be it a table row,
table column, header graphic, etc.?&amp;nbsp; Enter &lt;a href="http://www.mioplanet.com/products/pixelruler/index.htm"&gt;Pixel
Ruler&lt;/a&gt;--a free app that displays a rotatable ruler on your screen and even tracks
your mouse cursor and keeps a running measurement of how many pixels away you are
from the zero mark on the ruler (in one dimension of course--it doesn't do diagonal
measurements).&amp;nbsp; This app will save me countless hours of eyeballing and hoping
for the best, instead providing me with precise measurements to the pixel.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=c2a3cfa6-65b1-41bd-ad00-c928e9d55ec0" /&gt;</description>
      <comments>http://blog.lifecycle-solutions.com/CommentView,guid,c2a3cfa6-65b1-41bd-ad00-c928e9d55ec0.aspx</comments>
      <category>Patterns and Practices</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://blog.lifecycle-solutions.com/Trackback.aspx?guid=3b32e616-9485-41f9-8bea-e5f7e79ac6b5</trackback:ping>
      <pingback:server>http://blog.lifecycle-solutions.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.lifecycle-solutions.com/PermaLink,guid,3b32e616-9485-41f9-8bea-e5f7e79ac6b5.aspx</pingback:target>
      <dc:creator>Daniel Root</dc:creator>
      <wfw:comment>http://blog.lifecycle-solutions.com/CommentView,guid,3b32e616-9485-41f9-8bea-e5f7e79ac6b5.aspx</wfw:comment>
      <wfw:commentRss>http://blog.lifecycle-solutions.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3b32e616-9485-41f9-8bea-e5f7e79ac6b5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One technique we've started using is automating our apps' configuration using Pre-Build
Events and Build Configurations in Visual Studio.  It takes a little more work
to set up, but once you do, publishing test and production apps is much easier. 
It also helps the developer to think not just about a "<a href="http://www.codinghorror.com/blog/archives/000818.html">works
on my machine</a>" app, but an app that works on any number of scenarios.  Without
this approach, the developer still has to keep up with multiple config files, but
typically does so in their head. Scott Guthrie has a <a href="http://weblogs.asp.net/scottgu/archive/2007/09/21/tip-trick-automating-dev-qa-staging-and-production-web-config-settings-with-vs-2005.aspx">great
post showing how all this is done</a>.  However, a few tips will help you
fine tune your automation, so that development is even more painless:
</p>
        <ul>
          <li>
Decide the different scenarios your app will run in.  In our case there are typically
3: 
<ul><li>
Local - App is being developed and running on the developers' PC 
</li><li>
Staging - App is being tested in a copy of the production environment 
</li><li>
Production - App is "live".</li></ul></li>
          <li>
Create a folder named Configuration. 
</li>
          <li>
Create a .config file for each scenario above. 
<ul><li><em>Name the .config file scenario.web.config or scenario.app.config (ie local.web.config). 
Using this approach over Scott's means you still get intellisense in the .config files!</em></li><li>
If you have an existing .config file, just copy it to the Configuration folder and
rename it as above.  Remember that after this is set up, the "real" .config
file will be overwritten.  If you put blank .config files in Configuration, you'll
loose the "real" configuration file.</li></ul></li>
          <li>
Create Build Configurations in Configuration Manager for each scenario above.  
<ul><li>
In each configuration, add the following Pre-Build event 
</li><li><font size="2"><p>
IF EXIST "$(ProjectDir)Configuration\$(ConfigurationName).web.config" xcopy "$(ProjectDir)Configuration\$(ConfigurationName).web.config"
"$(ProjectDir)\web.config" /Y /R
</p></font></li><li><font size="2"><p></p></font><em>This script accomodates the naming schema above, and works with source
control by overwritting the read-only .config file. Note if your project is a windows
forms, console, or class library app, change "web.config" to "app.config"</em></li></ul></li>
        </ul>
        <p>
And that's it - before each build, the appropriate config file will be copied
over and used.  Note that you'll never want to change the .config file in your
project's root, as it will be overwritten.  Instead, whenever you need to change
configuration, decide how the change will affect each scenario, and change each .config
in your Configuration folder.
</p>
        <img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=3b32e616-9485-41f9-8bea-e5f7e79ac6b5" />
      </body>
      <title>Automate Your Configuration</title>
      <guid isPermaLink="false">http://blog.lifecycle-solutions.com/PermaLink,guid,3b32e616-9485-41f9-8bea-e5f7e79ac6b5.aspx</guid>
      <link>http://blog.lifecycle-solutions.com/2007/10/17/AutomateYourConfiguration.aspx</link>
      <pubDate>Wed, 17 Oct 2007 19:06:09 GMT</pubDate>
      <description>&lt;p&gt;
One technique we've started using is automating our apps' configuration using Pre-Build
Events and Build Configurations in Visual Studio.&amp;nbsp; It takes a little more work
to set up, but once you do, publishing test and production apps is much easier.&amp;nbsp;
It also helps the developer to think not just about a "&lt;a href="http://www.codinghorror.com/blog/archives/000818.html"&gt;works
on my machine&lt;/a&gt;" app, but an app that&amp;nbsp;works on any number of scenarios.&amp;nbsp;&amp;nbsp;Without
this approach, the developer still has to keep up with multiple config files, but
typically does so in&amp;nbsp;their head.&amp;nbsp;Scott Guthrie has a &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/09/21/tip-trick-automating-dev-qa-staging-and-production-web-config-settings-with-vs-2005.aspx"&gt;great
post showing how all&amp;nbsp;this is done&lt;/a&gt;.&amp;nbsp; However, a few tips will help you
fine tune your automation, so that development is even more painless:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Decide the different scenarios your app will run in.&amp;nbsp; In our case there are typically
3: 
&lt;ul&gt;
&lt;li&gt;
Local - App is being developed and running on the developers' PC 
&lt;li&gt;
Staging - App is being tested in a copy of the production environment 
&lt;li&gt;
Production - App is "live".&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Create a folder named Configuration. 
&lt;li&gt;
Create a .config file for each scenario above. 
&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Name the .config file scenario.web.config or scenario.app.config (ie local.web.config).&amp;nbsp;
Using this approach over Scott's means you still get intellisense in the .config files!&lt;/em&gt; 
&lt;li&gt;
If you have an existing .config file, just copy it to the Configuration folder and
rename it as above.&amp;nbsp; Remember that&amp;nbsp;after this is set up, the "real" .config
file will be overwritten.&amp;nbsp; If you put blank .config files in Configuration, you'll
loose the "real" configuration file.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Create Build Configurations in Configuration Manager&amp;nbsp;for each scenario above.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;
In each configuration, add the following Pre-Build event 
&lt;li&gt;
&lt;font size=2&gt; 
&lt;p&gt;
IF EXIST "$(ProjectDir)Configuration\$(ConfigurationName).web.config" xcopy "$(ProjectDir)Configuration\$(ConfigurationName).web.config"
"$(ProjectDir)\web.config" /Y /R
&lt;/p&gt;
&lt;/font&gt; 
&lt;li&gt;
&lt;font size=2&gt; 
&lt;p&gt;
&lt;/font&gt;&lt;em&gt;This script accomodates the naming schema above, and works with source
control by overwritting the read-only .config file. Note if your project is a windows
forms, console, or class library app, change "web.config" to "app.config"&lt;/em&gt;&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
And that's it - before each&amp;nbsp;build, the appropriate config file will be copied
over and used.&amp;nbsp; Note that you'll never want to change the .config file in your
project's root, as it will be overwritten.&amp;nbsp; Instead, whenever you need to change
configuration, decide how the change will affect each scenario, and change each .config
in your Configuration folder.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=3b32e616-9485-41f9-8bea-e5f7e79ac6b5" /&gt;</description>
      <comments>http://blog.lifecycle-solutions.com/CommentView,guid,3b32e616-9485-41f9-8bea-e5f7e79ac6b5.aspx</comments>
      <category>ASP.NET</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://blog.lifecycle-solutions.com/Trackback.aspx?guid=1361aace-70fe-4499-a78e-b9d2b67eb582</trackback:ping>
      <pingback:server>http://blog.lifecycle-solutions.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.lifecycle-solutions.com/PermaLink,guid,1361aace-70fe-4499-a78e-b9d2b67eb582.aspx</pingback:target>
      <dc:creator>Daniel Root</dc:creator>
      <wfw:comment>http://blog.lifecycle-solutions.com/CommentView,guid,1361aace-70fe-4499-a78e-b9d2b67eb582.aspx</wfw:comment>
      <wfw:commentRss>http://blog.lifecycle-solutions.com/SyndicationService.asmx/GetEntryCommentsRss?guid=1361aace-70fe-4499-a78e-b9d2b67eb582</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In the slides from <a href="http://weblogs.asp.net/scottgu/archive/2007/03/30/slides-from-my-asp-net-connections-talks-wpf-e-linq-and-asp-net-tips-tricks.aspx">Scott
Guthrie's 'ASP.NET Tips and Tricks' TechEd Presentation</a>, I ran across this gem. 
You can turn off debugging server-wide by adding the following to &lt;system.web&gt;
section in the server's machine.config file (typically located in C:\windows\Microsoft.NET\Framework\v&lt;version&gt;\Config):<br /><br />
       &lt;deployment retail="true"/&gt;
</p>
        <p>
This is a great backup in case developers forget to turn it off in the application
using &lt;compilation debug="false"/&gt;.  Scott also mentions a few of the negative
results of forgetting this little setting:
</p>
        <ul>
          <li>
Slower performance due to debug code</li>
          <li>
App uses much more memory</li>
          <li>
Client-side scripts are not cached</li>
        </ul>
        <img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=1361aace-70fe-4499-a78e-b9d2b67eb582" />
      </body>
      <title>How To: Disable deployment debug=true for entire server</title>
      <guid isPermaLink="false">http://blog.lifecycle-solutions.com/PermaLink,guid,1361aace-70fe-4499-a78e-b9d2b67eb582.aspx</guid>
      <link>http://blog.lifecycle-solutions.com/2007/04/02/HowToDisableDeploymentDebugtrueForEntireServer.aspx</link>
      <pubDate>Mon, 02 Apr 2007 14:09:25 GMT</pubDate>
      <description>&lt;p&gt;
In the slides from &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/03/30/slides-from-my-asp-net-connections-talks-wpf-e-linq-and-asp-net-tips-tricks.aspx"&gt;Scott
Guthrie's 'ASP.NET Tips and Tricks' TechEd Presentation&lt;/a&gt;, I ran across this gem.&amp;nbsp;
You can turn off debugging server-wide by adding the following to &amp;lt;system.web&amp;gt;
section in the server's machine.config file (typically located in C:\windows\Microsoft.NET\Framework\v&amp;lt;version&amp;gt;\Config):&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;deployment retail="true"/&amp;gt;
&lt;/p&gt;
&lt;p&gt;
This is a&amp;nbsp;great backup in case developers forget to turn it off in the application
using &amp;lt;compilation debug="false"/&amp;gt;.&amp;nbsp; Scott also mentions a few of the negative
results of forgetting this little setting:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Slower performance due to debug code&lt;/li&gt;
&lt;li&gt;
App uses much more memory&lt;/li&gt;
&lt;li&gt;
Client-side scripts are not cached&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=1361aace-70fe-4499-a78e-b9d2b67eb582" /&gt;</description>
      <comments>http://blog.lifecycle-solutions.com/CommentView,guid,1361aace-70fe-4499-a78e-b9d2b67eb582.aspx</comments>
      <category>ASP.NET</category>
      <category>Patterns and Practices</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://blog.lifecycle-solutions.com/Trackback.aspx?guid=5589150e-e518-45ff-a0a3-b74e8ddba757</trackback:ping>
      <pingback:server>http://blog.lifecycle-solutions.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.lifecycle-solutions.com/PermaLink,guid,5589150e-e518-45ff-a0a3-b74e8ddba757.aspx</pingback:target>
      <dc:creator>Daniel Root</dc:creator>
      <wfw:comment>http://blog.lifecycle-solutions.com/CommentView,guid,5589150e-e518-45ff-a0a3-b74e8ddba757.aspx</wfw:comment>
      <wfw:commentRss>http://blog.lifecycle-solutions.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5589150e-e518-45ff-a0a3-b74e8ddba757</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <img style="FLOAT: right; MARGIN: 1em" src="http://blog.lifecycle-solutions.com/content/binary/ReflectorScreenshot.png" border="0" />
        <p>
One of the most useful tools for .NET development is <a href="http://www.aisto.com/roeder/dotnet/">Lutz
Roeder's .NET Reflector</a>, now in version 5.  It uses reflection to peek inside
.NET assemblies and disassembles the IL back into C# or VB code for those times that
you need an in-depth look into <em>any</em> .NET library.  Ever wonder what
the code for System.String looked like? This release adds some really nice
features:
</p>
        <ul>
          <li>
Formatted code comments- doubles as a documentation browser for XML code-commented
members 
</li>
          <li>
'Expand members' in disassembler lets you see code for an entire class at once-
previously you had to look at each method separately. 
</li>
          <li>
New analyzer features shows where classes are instantiated and exposed. 
</li>
          <li>
Search Google or MSDN for a member</li>
        </ul>
        <p>
In addition to helping you debug code, this is also a great learning tool.  What
better way to understand framework development than to peek inside The Framework itself?
</p>
        <p>
 
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=5589150e-e518-45ff-a0a3-b74e8ddba757" />
      </body>
      <title>Essential Tool: Lutz Roeder's .NET Reflector v5</title>
      <guid isPermaLink="false">http://blog.lifecycle-solutions.com/PermaLink,guid,5589150e-e518-45ff-a0a3-b74e8ddba757.aspx</guid>
      <link>http://blog.lifecycle-solutions.com/2007/02/20/EssentialToolLutzRoedersNETReflectorV5.aspx</link>
      <pubDate>Tue, 20 Feb 2007 14:49:16 GMT</pubDate>
      <description>&lt;img style="FLOAT: right; MARGIN: 1em" src="http://blog.lifecycle-solutions.com/content/binary/ReflectorScreenshot.png" border=0&gt; 
&lt;p&gt;
One of the most useful tools for .NET development is&amp;nbsp;&lt;a href="http://www.aisto.com/roeder/dotnet/"&gt;Lutz
Roeder's .NET Reflector&lt;/a&gt;, now in version 5.&amp;nbsp; It uses reflection to peek inside
.NET assemblies and disassembles the IL back into C# or VB code for those times that
you need an in-depth look into &lt;em&gt;any&lt;/em&gt;&amp;nbsp;.NET library.&amp;nbsp; Ever wonder&amp;nbsp;what
the code for System.String looked like?&amp;nbsp;This&amp;nbsp;release adds some really&amp;nbsp;nice
features:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Formatted code comments- doubles as a documentation browser for XML code-commented
members 
&lt;li&gt;
'Expand members' in disassembler lets you see code for&amp;nbsp;an entire class at once-
previously you had to look at each method separately. 
&lt;li&gt;
New analyzer features shows where classes are instantiated and exposed. 
&lt;li&gt;
Search Google or MSDN for a member&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In addition to helping you debug code, this is also a great learning tool.&amp;nbsp; What
better way to understand framework development than to peek inside The Framework itself?
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=5589150e-e518-45ff-a0a3-b74e8ddba757" /&gt;</description>
      <comments>http://blog.lifecycle-solutions.com/CommentView,guid,5589150e-e518-45ff-a0a3-b74e8ddba757.aspx</comments>
      <category>ASP.NET</category>
      <category>C#</category>
      <category>Documentation</category>
      <category>Patterns and Practices</category>
      <category>Training</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://blog.lifecycle-solutions.com/Trackback.aspx?guid=61de4652-d90a-4ff8-8b83-b28caa463eb6</trackback:ping>
      <pingback:server>http://blog.lifecycle-solutions.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.lifecycle-solutions.com/PermaLink,guid,61de4652-d90a-4ff8-8b83-b28caa463eb6.aspx</pingback:target>
      <dc:creator>Daniel Root</dc:creator>
      <wfw:comment>http://blog.lifecycle-solutions.com/CommentView,guid,61de4652-d90a-4ff8-8b83-b28caa463eb6.aspx</wfw:comment>
      <wfw:commentRss>http://blog.lifecycle-solutions.com/SyndicationService.asmx/GetEntryCommentsRss?guid=61de4652-d90a-4ff8-8b83-b28caa463eb6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">A quick tip for the Visual Studio 2003
and 2005 code editor: If you want to quickly change the case of some text, just select
the text and hit Ctrl-Shift-U for upper or Ctrl-U for lower.  Not exactly earth-shattering,
but I was pleasantly suprised when I needed to upper-case a large chunk of text today
and found this.<br /><p></p><img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=61de4652-d90a-4ff8-8b83-b28caa463eb6" /></body>
      <title>Control- Shift - U</title>
      <guid isPermaLink="false">http://blog.lifecycle-solutions.com/PermaLink,guid,61de4652-d90a-4ff8-8b83-b28caa463eb6.aspx</guid>
      <link>http://blog.lifecycle-solutions.com/2006/08/22/ControlShiftU.aspx</link>
      <pubDate>Tue, 22 Aug 2006 22:12:02 GMT</pubDate>
      <description>A quick tip for the Visual Studio 2003 and 2005 code editor: If you want to quickly change the case of some text, just select the text and hit Ctrl-Shift-U for upper or Ctrl-U for lower.&amp;nbsp; Not exactly earth-shattering, but I was pleasantly suprised when I needed to upper-case a large chunk of text today and found this.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.lifecycle-solutions.com/aggbug.ashx?id=61de4652-d90a-4ff8-8b83-b28caa463eb6" /&gt;</description>
      <comments>http://blog.lifecycle-solutions.com/CommentView,guid,61de4652-d90a-4ff8-8b83-b28caa463eb6.aspx</comments>
      <category>Visual Studio</category>
    </item>
  </channel>
</rss>