<?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>Jay Harris is Cpt. LoadTest - Visual Studio</title>
    <link>http://www.cptloadtest.com/</link>
    <description>a .net developers blog on improving user experience of humans and coders</description>
    <language>en-us</language>
    <copyright>Jason Harris</copyright>
    <lastBuildDate>Mon, 26 Jan 2009 16:38:48 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.12105.0</generator>
    <managingEditor>jharris@harrisdesigns.com</managingEditor>
    <webMaster>jharris@harrisdesigns.com</webMaster>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=084a817f-c549-4ad4-9dab-ffc998c7b487</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,084a817f-c549-4ad4-9dab-ffc998c7b487.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,084a817f-c549-4ad4-9dab-ffc998c7b487.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=084a817f-c549-4ad4-9dab-ffc998c7b487</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Increasing or decreasing the font size of your code in Visual Studio's text editor
is almost required whenever VS is fired up on a projector. Anyone who has had to demo
code, or give a talk at a user group, or present new technologies to their team has
experienced the pain of increasing the font size through the <em>Tools -&gt; Options</em> menu,
followed by an inquiry to the crowd: "How's that? Is this font size readable by everyone?"
Often times the selected size is not quite the right solution, and the process is
repeated. Life as a presenter would be easier if only you could modify the font size
through a simple keyboard command, similar to how browsers enable you adjust the font
through the <em>ctrl+</em> and <em>ctrl-</em> commands.
</p>
        <blockquote>
          <p>
            <strong>Macros.Samples.Accessibility.DecreaseTextEditorFontSize<br /></strong>Decreases the text editor font size in Visual Studio
</p>
          <p>
            <strong>Macros.Samples.Accessibility.IncreaseTextEditorFontSize<br /></strong>Increases the text editor font size in Visual Studio
</p>
        </blockquote>
        <p>
Fortunately, this is easy with the help of Visual Studio's Sample Macros. To help
show you the ropes of writing custom macros, VS ships with a collection samples, and
two of these samples respectively increase and decrease the font size of the text
editor. Right out of the box, Visual Studio comes with the ability to modify the font
size for your code; all that remains is mapping these macros to the keyboard.
</p>
        <h3>
          <img style="margin: 0px 0px 10px 20px" alt="Visual Studio Options Window, Assigning Macro to Keyboard Command" src="http://www.cptloadtest.com/content/binary/VSMacroIncreaseTextOptionsWindow.jpg" align="right" />Mapping
to the Keyboard
</h3>
        <p>
Anchoring these macros to specific keyboard commands is a simple process.
</p>
        <ol>
          <li>
From Visual Studio, access the <em>Tools -&gt; Options</em> menu.</li>
          <li>
In the <em>Options</em> window, navigate to <em>Environment -&gt; Keyboard</em>.</li>
          <li>
Using the "<em>Show commands containing"</em> input, enter in <em>IncreaseText</em> or <em>DecreaseText</em>.
The list of available commands will automatically filter as you type, reducing the
list to the applicable macro.</li>
          <li>
Select the macro command, and select the "<em>Press shortcut keys"</em> input, and
enter your desired keyboard command. Click the <em>Assign</em> button to set the command.
I use "<em>Ctrl, Alt, Shift, =</em>" (plus) and "<em>Ctrl, Alt, Shift, -</em>" for
my Increase and Decrease commands, respectively.</li>
        </ol>
        <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:af70b901-9836-405b-a0dc-b38bbcf6bff5" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati
Tags: <a href="http://technorati.com/tags/Visual%20Studio" rel="tag">Visual Studio</a>,<a href="http://technorati.com/tags/Presenting" rel="tag">Presenting</a>,<a href="http://technorati.com/tags/Speaking" rel="tag">Speaking</a>,<a href="http://technorati.com/tags/Macros" rel="tag">Macros</a></div>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=084a817f-c549-4ad4-9dab-ffc998c7b487" />
      </body>
      <title>Visual Studio Macro: Modify Text Editor Font Size</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,084a817f-c549-4ad4-9dab-ffc998c7b487.aspx</guid>
      <link>http://www.cptloadtest.com/2009/01/26/Visual-Studio-Macro-Modify-Text-Editor-Font-Size.aspx</link>
      <pubDate>Mon, 26 Jan 2009 16:38:48 GMT</pubDate>
      <description>&lt;p&gt;
Increasing or decreasing the font size of your code in Visual Studio's text editor
is almost required whenever VS is fired up on a projector. Anyone who has had to demo
code, or give a talk at a user group, or present new technologies to their team has
experienced the pain of increasing the font size through the &lt;em&gt;Tools -&amp;gt; Options&lt;/em&gt; menu,
followed by an inquiry to the crowd: "How's that? Is this font size readable by everyone?"
Often times the selected size is not quite the right solution, and the process is
repeated. Life as a presenter would be easier if only you could modify the font size
through a simple keyboard command, similar to how browsers enable you adjust the font
through the &lt;em&gt;ctrl+&lt;/em&gt; and &lt;em&gt;ctrl-&lt;/em&gt; commands.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;Macros.Samples.Accessibility.DecreaseTextEditorFontSize&lt;br&gt;
&lt;/strong&gt;Decreases the text editor font size in Visual Studio
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Macros.Samples.Accessibility.IncreaseTextEditorFontSize&lt;br&gt;
&lt;/strong&gt;Increases the text editor font size in Visual Studio
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Fortunately, this is easy with the help of Visual Studio's Sample Macros. To help
show you the ropes of writing custom macros, VS ships with a collection samples, and
two of these samples respectively increase and decrease the font size of the text
editor. Right out of the box, Visual Studio comes with the ability to modify the font
size for your code; all that remains is mapping these macros to the keyboard.
&lt;/p&gt;
&lt;h3&gt;&lt;img style="margin: 0px 0px 10px 20px" alt="Visual Studio Options Window, Assigning Macro to Keyboard Command" src="http://www.cptloadtest.com/content/binary/VSMacroIncreaseTextOptionsWindow.jpg" align="right"&gt;Mapping
to the Keyboard
&lt;/h3&gt;
&lt;p&gt;
Anchoring these macros to specific keyboard commands is a simple process.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
From Visual Studio, access the &lt;em&gt;Tools -&amp;gt; Options&lt;/em&gt; menu.&lt;/li&gt;
&lt;li&gt;
In the &lt;em&gt;Options&lt;/em&gt; window, navigate to &lt;em&gt;Environment -&amp;gt; Keyboard&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
Using the "&lt;em&gt;Show commands containing"&lt;/em&gt; input, enter in &lt;em&gt;IncreaseText&lt;/em&gt; or &lt;em&gt;DecreaseText&lt;/em&gt;.
The list of available commands will automatically filter as you type, reducing the
list to the applicable macro.&lt;/li&gt;
&lt;li&gt;
Select the macro command, and select the "&lt;em&gt;Press shortcut keys"&lt;/em&gt; input, and
enter your desired keyboard command. Click the &lt;em&gt;Assign&lt;/em&gt; button to set the command.
I use "&lt;em&gt;Ctrl, Alt, Shift, =&lt;/em&gt;" (plus) and "&lt;em&gt;Ctrl, Alt, Shift, -&lt;/em&gt;" for
my Increase and Decrease commands, respectively.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:af70b901-9836-405b-a0dc-b38bbcf6bff5" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati
Tags: &lt;a href="http://technorati.com/tags/Visual%20Studio" rel="tag"&gt;Visual Studio&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Presenting" rel="tag"&gt;Presenting&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Speaking" rel="tag"&gt;Speaking&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Macros" rel="tag"&gt;Macros&lt;/a&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=084a817f-c549-4ad4-9dab-ffc998c7b487" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,084a817f-c549-4ad4-9dab-ffc998c7b487.aspx</comments>
      <category>Speaking</category>
      <category>Tools</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=8cbaa378-4e19-4a01-b005-78de6bcf4121</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,8cbaa378-4e19-4a01-b005-78de6bcf4121.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,8cbaa378-4e19-4a01-b005-78de6bcf4121.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=8cbaa378-4e19-4a01-b005-78de6bcf4121</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Most of our Visual Studio solutions contain hundreds of files (classes) organized
neatly into dozens of folders (namespaces), but despite all of this organization the
vertical content size of the Solution Explorer can get quite large. Finding a particular
file when the majority of the tree is expanded is tedious and time-consuming, considering
it should be a simple effort of less than five seconds. Fortunately, all of this is
solved by the click of a button (assigned to handy macro).
</p>
        <p>
The most useful macro for Visual Studio that I have ever encountered (and in the running
for most useful VS tool, period) is the CollapseAll macro authored by one current
and one former colleague, Dennis Burton and Mike Shields. In a quick XP effort, Dennis
and Mike created a handy macro that recursively collapses the entire Solution Explorer
tree down to just the solution and its projects.
</p>
        <p>
With the tree collapsed, it is easy to find that desired file.
</p>
        <p>
The macro is functional in all versions of Visual Studio for the Microsoft.Net framework,
including Visual Studio 2003, Visual Studio 2005, and Visual Studio 2008.<br /></p>
        <p>
          <strong>CollapseAll Macro for Microsoft Visual Studio</strong>
          <br />
Dennis Burton &amp; Mike Shields | <em>Published with Permission</em></p>
        <pre name="code" class="vb">Imports System
Imports EnvDTE
Imports System.Diagnostics

Public Module CollapseAll
    Sub CollapseAll()
        ' Get the the Solution Explorer tree
        Dim UIHSolutionExplorer As UIHierarchy
        UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
        ' Check if there is any open solution
        If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
            ' MsgBox("Nothing to collapse. You must have an open solution.")
            Return
        End If
        ' Get the top node (the name of the solution)
        Dim UIHSolutionRootNode As UIHierarchyItem
        UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
        UIHSolutionExplorer = Nothing
        UIHSolutionRootNode.DTE.SuppressUI = True
        ' Collapse each project node
        Dim UIHItem As UIHierarchyItem
        For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
            'UIHItem.UIHierarchyItems.Expanded = False
            If UIHItem.UIHierarchyItems.Expanded Then
                Collapse(UIHItem)
            End If
        Next
        ' Select the solution node, or else when you click
        ' on the solution window
        ' scrollbar, it will synchronize the open document
        ' with the tree and pop
        ' out the corresponding node which is probably not what you want.
        UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
        UIHSolutionRootNode.DTE.SuppressUI = False
        UIHSolutionRootNode = Nothing
    End Sub

    Private Sub Collapse(ByVal item As UIHierarchyItem)
        For Each eitem As UIHierarchyItem In item.UIHierarchyItems
            If eitem.UIHierarchyItems.Expanded AndAlso eitem.UIHierarchyItems.Count &gt; 0 Then
                Collapse(eitem)
            End If
        Next
        item.UIHierarchyItems.Expanded = False
    End Sub
End Module
</pre>
        <p>
          <em>Based on code from <a href="http://www.codeproject.com/macro/collapseall.asp">Edwin
Evans</a></em>
        </p>
        <p>
Here, the macro is so popular that it is a part of our default developer’s build for
every new machine, and is conveniently assigned to a toolbar button. The default button
icon list contains an Up Arrow (in the Change Button Image menu when customizing the
toolbar) that seems quite appropriate. That little button has saved us all from a
lot of pain, five seconds at a time.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=8cbaa378-4e19-4a01-b005-78de6bcf4121" />
      </body>
      <title>Visual Studio Macro: Solution Explorer Collapse All</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,8cbaa378-4e19-4a01-b005-78de6bcf4121.aspx</guid>
      <link>http://www.cptloadtest.com/2006/05/31/Visual-Studio-Macro-Solution-Explorer-Collapse-All.aspx</link>
      <pubDate>Wed, 31 May 2006 14:19:55 GMT</pubDate>
      <description>&lt;p&gt;
Most of our Visual Studio solutions contain hundreds of files (classes) organized
neatly into dozens of folders (namespaces), but despite all of this organization the
vertical content size of the Solution Explorer can get quite large. Finding a particular
file when the majority of the tree is expanded is tedious and time-consuming, considering
it should be a simple effort of less than five seconds. Fortunately, all of this is
solved by the click of a button (assigned to handy macro).
&lt;/p&gt;
&lt;p&gt;
The most useful macro for Visual Studio that I have ever encountered (and in the running
for most useful VS tool, period) is the CollapseAll macro authored by one current
and one former colleague, Dennis Burton and Mike Shields. In a quick XP effort, Dennis
and Mike created a handy macro that recursively collapses the entire Solution Explorer
tree down to just the solution and its projects.
&lt;/p&gt;
&lt;p&gt;
With the tree collapsed, it is easy to find that desired file.
&lt;/p&gt;
&lt;p&gt;
The macro is functional in all versions of Visual Studio for the Microsoft.Net framework,
including Visual Studio 2003, Visual Studio 2005, and Visual Studio 2008.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;CollapseAll Macro for Microsoft Visual Studio&lt;/strong&gt;
&lt;br&gt;
Dennis Burton &amp;amp; Mike Shields | &lt;em&gt;Published with Permission&lt;/em&gt;
&lt;/p&gt;
&lt;pre name="code" class="vb"&gt;Imports System
Imports EnvDTE
Imports System.Diagnostics

Public Module CollapseAll
    Sub CollapseAll()
        ' Get the the Solution Explorer tree
        Dim UIHSolutionExplorer As UIHierarchy
        UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
        ' Check if there is any open solution
        If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
            ' MsgBox("Nothing to collapse. You must have an open solution.")
            Return
        End If
        ' Get the top node (the name of the solution)
        Dim UIHSolutionRootNode As UIHierarchyItem
        UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
        UIHSolutionExplorer = Nothing
        UIHSolutionRootNode.DTE.SuppressUI = True
        ' Collapse each project node
        Dim UIHItem As UIHierarchyItem
        For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
            'UIHItem.UIHierarchyItems.Expanded = False
            If UIHItem.UIHierarchyItems.Expanded Then
                Collapse(UIHItem)
            End If
        Next
        ' Select the solution node, or else when you click
        ' on the solution window
        ' scrollbar, it will synchronize the open document
        ' with the tree and pop
        ' out the corresponding node which is probably not what you want.
        UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
        UIHSolutionRootNode.DTE.SuppressUI = False
        UIHSolutionRootNode = Nothing
    End Sub

    Private Sub Collapse(ByVal item As UIHierarchyItem)
        For Each eitem As UIHierarchyItem In item.UIHierarchyItems
            If eitem.UIHierarchyItems.Expanded AndAlso eitem.UIHierarchyItems.Count &amp;gt; 0 Then
                Collapse(eitem)
            End If
        Next
        item.UIHierarchyItems.Expanded = False
    End Sub
End Module
&lt;/pre&gt;
&lt;p&gt;
&lt;em&gt;Based on code from &lt;a href="http://www.codeproject.com/macro/collapseall.asp"&gt;Edwin
Evans&lt;/a&gt;&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
Here, the macro is so popular that it is a part of our default developer’s build for
every new machine, and is conveniently assigned to a toolbar button. The default button
icon list contains an Up Arrow (in the Change Button Image menu when customizing the
toolbar) that seems quite appropriate. That little button has saved us all from a
lot of pain, five seconds at a time.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=8cbaa378-4e19-4a01-b005-78de6bcf4121" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,8cbaa378-4e19-4a01-b005-78de6bcf4121.aspx</comments>
      <category>Programming</category>
      <category>Tools</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=ccfd87ed-d405-4ede-9ae3-999e231d2df9</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,ccfd87ed-d405-4ede-9ae3-999e231d2df9.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,ccfd87ed-d405-4ede-9ae3-999e231d2df9.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ccfd87ed-d405-4ede-9ae3-999e231d2df9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
NAnt hates .Net’s resource files, or .resx. Don’t get me wrong–it handles them just
fine–but large quantities of resx will really bog it down.
</p>
        <p>
Visual Studio loves resx. The IDE will automatically create a resource file for you
when you open pages and controls in the ‘designer’ view. Back when we still used Visual
SourceSafe as our SCM, Visual Studio happily checked the file in and forgot about
it. Now, our 500+ page application has 500+ resource files. Most of these 500+ resource
files contain zero resources, making them useless, pointless, and a detriment to the
build.
</p>
        <p>
This morning I went through the build log, noting every resx that contained zero resources,
and deleted all of these useless files.
</p>
        <p>
The compile time dropped by 5 minutes.
</p>
        <p>
          <em>Moral of the story:</em> Be weary of Visual Studio. With regards to resx, VS is
a malware program that’s just filling your hard drive with junk. If you use resx,
great, but if you don’t, delete them all. NAnt will love you for it.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=ccfd87ed-d405-4ede-9ae3-999e231d2df9" />
      </body>
      <title>NAnt slowdowns: Visual Studio, the .resx machine</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,ccfd87ed-d405-4ede-9ae3-999e231d2df9.aspx</guid>
      <link>http://www.cptloadtest.com/2006/02/15/NAnt-Slowdowns-Visual-Studio-The-Resx-Machine.aspx</link>
      <pubDate>Wed, 15 Feb 2006 16:31:31 GMT</pubDate>
      <description>&lt;p&gt;
NAnt hates .Net’s resource files, or .resx. Don’t get me wrong–it handles them just
fine–but large quantities of resx will really bog it down.
&lt;/p&gt;
&lt;p&gt;
Visual Studio loves resx. The IDE will automatically create a resource file for you
when you open pages and controls in the ‘designer’ view. Back when we still used Visual
SourceSafe as our SCM, Visual Studio happily checked the file in and forgot about
it. Now, our 500+ page application has 500+ resource files. Most of these 500+ resource
files contain zero resources, making them useless, pointless, and a detriment to the
build.
&lt;/p&gt;
&lt;p&gt;
This morning I went through the build log, noting every resx that contained zero resources,
and deleted all of these useless files.
&lt;/p&gt;
&lt;p&gt;
The compile time dropped by 5 minutes.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Moral of the story:&lt;/em&gt; Be weary of Visual Studio. With regards to resx, VS is
a malware program that’s just filling your hard drive with junk. If you use resx,
great, but if you don’t, delete them all. NAnt will love you for it.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=ccfd87ed-d405-4ede-9ae3-999e231d2df9" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,ccfd87ed-d405-4ede-9ae3-999e231d2df9.aspx</comments>
      <category>ASP.Net</category>
      <category>Continuous Integration</category>
      <category>NAnt</category>
      <category>Programming</category>
      <category>Task Automation</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=185d4fd2-87ca-49d8-b7f9-b06b3068559e</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,185d4fd2-87ca-49d8-b7f9-b06b3068559e.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,185d4fd2-87ca-49d8-b7f9-b06b3068559e.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=185d4fd2-87ca-49d8-b7f9-b06b3068559e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
“It compiles! Ship it!”
</p>
        <p>
Microsoft has sent Visual Studio 2005 to the printers. That brings .Net 2.0 to the
table in all of its glory. The official release date is still November 7, and though
it is available now to all of us MSDN subscribers (though the site is too flooded
to ping, let alone download), there is still some question on if the media will be
ready in time to go in all of the pretty little VS05 boxes at your local Microsoft
store.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=185d4fd2-87ca-49d8-b7f9-b06b3068559e" />
      </body>
      <title>Visual Studio 2005 goes gold</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,185d4fd2-87ca-49d8-b7f9-b06b3068559e.aspx</guid>
      <link>http://www.cptloadtest.com/2005/10/28/Visual-Studio-2005-Goes-Gold.aspx</link>
      <pubDate>Fri, 28 Oct 2005 17:40:03 GMT</pubDate>
      <description>&lt;p&gt;
“It compiles! Ship it!”
&lt;/p&gt;
&lt;p&gt;
Microsoft has sent Visual Studio 2005 to the printers. That brings .Net 2.0 to the
table in all of its glory. The official release date is still November 7, and though
it is available now to all of us MSDN subscribers (though the site is too flooded
to ping, let alone download), there is still some question on if the media will be
ready in time to go in all of the pretty little VS05 boxes at your local Microsoft
store.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=185d4fd2-87ca-49d8-b7f9-b06b3068559e" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,185d4fd2-87ca-49d8-b7f9-b06b3068559e.aspx</comments>
      <category>ASP.Net</category>
      <category>Programming</category>
      <category>Tools</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.cptloadtest.com/Trackback.aspx?guid=de45fc73-2205-457c-ac02-5c83a8cd4ad9</trackback:ping>
      <pingback:server>http://www.cptloadtest.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.cptloadtest.com/PermaLink,guid,de45fc73-2205-457c-ac02-5c83a8cd4ad9.aspx</pingback:target>
      <dc:creator>Jay Harris</dc:creator>
      <wfw:comment>http://www.cptloadtest.com/CommentView,guid,de45fc73-2205-457c-ac02-5c83a8cd4ad9.aspx</wfw:comment>
      <wfw:commentRss>http://www.cptloadtest.com/SyndicationService.asmx/GetEntryCommentsRss?guid=de45fc73-2205-457c-ac02-5c83a8cd4ad9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
With our new <a href="http://www.cptloadtest.com/2005/08/23/DatabaseRestoreThroughNAnt.aspx">nightly
database restore</a> we now have the desire to automatically run all of the change
scripts associated with a project. We’ve found a way; I created a NAnt script that
will parse the Visual Studio Database Project (or "DBP") and execute all of the change
scripts in it. Here’s how we got there.
</p>
        <hr />
        <h3>Problem 1: Visual Studio Command Files are worthless
</h3>
        <p>
Our first idea was to have everyone update a command file in the DBP, and have NAnt
run it every night. Visual Studio command files are great and all, but we have discovered
a problem with them: they do not keep the files in order. We have named all of our
folders (01 DDL, 02 DML, etc) and our change scripts (0001 Create MyTable.sql, 0002
AddInfoColumn to MyTable.sql) accordingly so that they <em>should</em> run in order.
We have found that the command file feature of VS.Net 2003 does not keep them in order
but rather seems to sort them first by extension, then by order, or some similar oddness.
Obviously, if I try to at InfoColumn to MyTable before MyTable exists, I’m going to
have a problem. So, the command file idea was axed.
</p>
        <h3>Problem 2: Visual SourceSafe contents can’t be trusted
</h3>
        <p>
Our second idea was to VSSGET the DBP directory in VSS and execute every script in
it. However, the VSS store cannot be trusted. If a developer creates a script in VS.Net
called ‘0001 Crate MyTable.sql’ and checks it in to the project, then proceeds to
correct the spelling error in VS.Net to ‘0001 Create MyTable.sql’, VS does not rename
the old file in VSS. Instead, it removes the old file from the project, renames it
locally, then adds the new name to the project and to VSS. It also never deletes the
old file name from the VSS store. Now, both files (’0001 Crate MyTable.sql’ and ‘0001
Create MyTable.sql’) exist in VSS. Performing a VSSGET and executing all scripts will
run both scripts, which could lead to more troubles.
</p>
        <hr />
        <p>
So, we can’t use a command file, because it won’t maintain the order. We can’t trust
VSS, since it can have obsolete files. We can only trust the project, but how do we
get a list of files, ourselves?
</p>
        <p>
Fortunately, DBP files are just text in a weird XML-wannabe format. The NAnt script
will open the file and run through it looking for every ‘SCRIPT’ entry in the file.
If it finds a ‘BEGIN something’ entry, it assumes that ’something’ is a folder name,
and appends it to the working path until it finds ‘END’, at which time it returns
to the parent directory.
</p>
        <p>
It’s not perfect. It still runs in to some problems, but here it is in v0.1 form.
</p>
        <pre name="code" class="xml">&lt;project name="RunDBPScripts" default="RunScripts"&gt;
&lt;!–-
Execute all scripts in a VS.Net DBP
Author: Jay Harris, http://www.cptloadtest.com, (c) 2005 Jason Harris
License: This work is licensed under a  
   Creative Commons Attribution 3.0 United States License.  
   http://creativecommons.org/licenses/by/3.0/us/ 

This script is offered as-is.
I am not responsible for any misfortunes that may arise from its use.
Use at your own risk.
-–&gt;
&lt;!-– Project: The path of the DBP file –-&gt;
&lt;property name="project" value="Scripts.dbp" overwrite="false" /&gt;
&lt;!-– Server: The machine name of the Database Server –-&gt;
&lt;property name="server" value="localhost" overwrite="false" /&gt;
&lt;!-– Database: The database that the scripts will be run against –-&gt;
&lt;property name="database" value="Northwind" overwrite="false" /&gt;
&lt;target name="RunScripts"&gt;
        &lt;property name="currentpath"
            value="${directory::get-parent-directory(project)}" /&gt;
        &lt;foreach item="Line" property="ProjectLineItem" in="${project}"&gt;
            &lt;if test="${string::contains(ProjectLineItem, 'Begin Folder = ')}"&gt;
                &lt;regex pattern="Folder = &amp;quot;(?’ProjectFolder’.*)&amp;quot;$"
                    input="${string::trim(ProjectLineItem)}" /&gt;
                &lt;property name="currentpath"
                    value="${path::combine(currentpath, ProjectFolder)}" /&gt;
            &lt;/if&gt;
            &lt;if test="${string::contains(ProjectLineItem, 'Script = ')}"&gt;
                &lt;regex pattern="Script = &amp;quot;(?’ScriptName’.*)&amp;quot;$"
                    input="${string::trim(ProjectLineItem)}" /&gt;
                &lt;echo message="Executing Change Script (${server+"\"+database}): ${path::combine(currentpath, ScriptName)}" /&gt;
                &lt;exec workingdir="${currentpath}" program="osql"
                    basedir="C:\Program Files\Microsoft SQL Server\80\Tools\Binn"
                    commandline=’-S ${server} -d ${database} -i “${ScriptName}" -n -E -b’ /&gt;
            &lt;/if&gt;
            &lt;if test="${string::trim(ProjectLineItem) == 'End’}"&gt;
                &lt;property name="currentpath"
                    value="${directory::get-parent-directory(currentpath)}" /&gt;
            &lt;/if&gt;
        &lt;/foreach&gt;
    &lt;/target&gt;
&lt;/project&gt;</pre>
        <p>
I used an &lt;EXEC&gt; NAnt task rather than &lt;SQL&gt;. I found that a lot of the
scripts would not execute in the SQL task because of their design. VS Command Files
use OSQL, so that’s what I used. I guess those command files were worth something
after all.
</p>
        <p>
If you know of a better way, or have any suggestions or comments, please let me know.
</p>
        <img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=de45fc73-2205-457c-ac02-5c83a8cd4ad9" />
      </body>
      <title>NAnt and Visual Studio database projects</title>
      <guid isPermaLink="false">http://www.cptloadtest.com/PermaLink,guid,de45fc73-2205-457c-ac02-5c83a8cd4ad9.aspx</guid>
      <link>http://www.cptloadtest.com/2005/08/25/NAnt-And-Visual-Studio-Database-Projects.aspx</link>
      <pubDate>Thu, 25 Aug 2005 16:15:41 GMT</pubDate>
      <description>&lt;p&gt;
With our new &lt;a href="http://www.cptloadtest.com/2005/08/23/DatabaseRestoreThroughNAnt.aspx"&gt;nightly
database restore&lt;/a&gt; we now have the desire to automatically run all of the change
scripts associated with a project. We’ve found a way; I created a NAnt script that
will parse the Visual Studio Database Project (or "DBP") and execute all of the change
scripts in it. Here’s how we got there.
&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Problem 1: Visual Studio Command Files are worthless
&lt;/h3&gt;
&lt;p&gt;
Our first idea was to have everyone update a command file in the DBP, and have NAnt
run it every night. Visual Studio command files are great and all, but we have discovered
a problem with them: they do not keep the files in order. We have named all of our
folders (01 DDL, 02 DML, etc) and our change scripts (0001 Create MyTable.sql, 0002
AddInfoColumn to MyTable.sql) accordingly so that they &lt;em&gt;should&lt;/em&gt; run in order.
We have found that the command file feature of VS.Net 2003 does not keep them in order
but rather seems to sort them first by extension, then by order, or some similar oddness.
Obviously, if I try to at InfoColumn to MyTable before MyTable exists, I’m going to
have a problem. So, the command file idea was axed.
&lt;/p&gt;
&lt;h3&gt;Problem 2: Visual SourceSafe contents can’t be trusted
&lt;/h3&gt;
&lt;p&gt;
Our second idea was to VSSGET the DBP directory in VSS and execute every script in
it. However, the VSS store cannot be trusted. If a developer creates a script in VS.Net
called ‘0001 Crate MyTable.sql’ and checks it in to the project, then proceeds to
correct the spelling error in VS.Net to ‘0001 Create MyTable.sql’, VS does not rename
the old file in VSS. Instead, it removes the old file from the project, renames it
locally, then adds the new name to the project and to VSS. It also never deletes the
old file name from the VSS store. Now, both files (’0001 Crate MyTable.sql’ and ‘0001
Create MyTable.sql’) exist in VSS. Performing a VSSGET and executing all scripts will
run both scripts, which could lead to more troubles.
&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;
So, we can’t use a command file, because it won’t maintain the order. We can’t trust
VSS, since it can have obsolete files. We can only trust the project, but how do we
get a list of files, ourselves?
&lt;/p&gt;
&lt;p&gt;
Fortunately, DBP files are just text in a weird XML-wannabe format. The NAnt script
will open the file and run through it looking for every ‘SCRIPT’ entry in the file.
If it finds a ‘BEGIN something’ entry, it assumes that ’something’ is a folder name,
and appends it to the working path until it finds ‘END’, at which time it returns
to the parent directory.
&lt;/p&gt;
&lt;p&gt;
It’s not perfect. It still runs in to some problems, but here it is in v0.1 form.
&lt;/p&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;project name="RunDBPScripts" default="RunScripts"&amp;gt;
&amp;lt;!–-
Execute all scripts in a VS.Net DBP
Author: Jay Harris, http://www.cptloadtest.com, (c) 2005 Jason Harris
License: This work is licensed under a  
   Creative Commons Attribution 3.0 United States License.  
   http://creativecommons.org/licenses/by/3.0/us/ 

This script is offered as-is.
I am not responsible for any misfortunes that may arise from its use.
Use at your own risk.
-–&amp;gt;
&amp;lt;!-– Project: The path of the DBP file –-&amp;gt;
&amp;lt;property name="project" value="Scripts.dbp" overwrite="false" /&amp;gt;
&amp;lt;!-– Server: The machine name of the Database Server –-&amp;gt;
&amp;lt;property name="server" value="localhost" overwrite="false" /&amp;gt;
&amp;lt;!-– Database: The database that the scripts will be run against –-&amp;gt;
&amp;lt;property name="database" value="Northwind" overwrite="false" /&amp;gt;
&amp;lt;target name="RunScripts"&amp;gt;
        &amp;lt;property name="currentpath"
            value="${directory::get-parent-directory(project)}" /&amp;gt;
        &amp;lt;foreach item="Line" property="ProjectLineItem" in="${project}"&amp;gt;
            &amp;lt;if test="${string::contains(ProjectLineItem, 'Begin Folder = ')}"&amp;gt;
                &amp;lt;regex pattern="Folder = &amp;amp;quot;(?’ProjectFolder’.*)&amp;amp;quot;$"
                    input="${string::trim(ProjectLineItem)}" /&amp;gt;
                &amp;lt;property name="currentpath"
                    value="${path::combine(currentpath, ProjectFolder)}" /&amp;gt;
            &amp;lt;/if&amp;gt;
            &amp;lt;if test="${string::contains(ProjectLineItem, 'Script = ')}"&amp;gt;
                &amp;lt;regex pattern="Script = &amp;amp;quot;(?’ScriptName’.*)&amp;amp;quot;$"
                    input="${string::trim(ProjectLineItem)}" /&amp;gt;
                &amp;lt;echo message="Executing Change Script (${server+"\"+database}): ${path::combine(currentpath, ScriptName)}" /&amp;gt;
                &amp;lt;exec workingdir="${currentpath}" program="osql"
                    basedir="C:\Program Files\Microsoft SQL Server\80\Tools\Binn"
                    commandline=’-S ${server} -d ${database} -i “${ScriptName}" -n -E -b’ /&amp;gt;
            &amp;lt;/if&amp;gt;
            &amp;lt;if test="${string::trim(ProjectLineItem) == 'End’}"&amp;gt;
                &amp;lt;property name="currentpath"
                    value="${directory::get-parent-directory(currentpath)}" /&amp;gt;
            &amp;lt;/if&amp;gt;
        &amp;lt;/foreach&amp;gt;
    &amp;lt;/target&amp;gt;
&amp;lt;/project&amp;gt;&lt;/pre&gt;
&lt;p&gt;
I used an &amp;lt;EXEC&amp;gt; NAnt task rather than &amp;lt;SQL&amp;gt;. I found that a lot of the
scripts would not execute in the SQL task because of their design. VS Command Files
use OSQL, so that’s what I used. I guess those command files were worth something
after all.
&lt;/p&gt;
&lt;p&gt;
If you know of a better way, or have any suggestions or comments, please let me know.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.cptloadtest.com/aggbug.ashx?id=de45fc73-2205-457c-ac02-5c83a8cd4ad9" /&gt;</description>
      <comments>http://www.cptloadtest.com/CommentView,guid,de45fc73-2205-457c-ac02-5c83a8cd4ad9.aspx</comments>
      <category>Continuous Integration</category>
      <category>NAnt</category>
      <category>Task Automation</category>
      <category>Visual Studio</category>
    </item>
  </channel>
</rss>