<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Code Assassin</title>
	<atom:link href="http://blog.codeassassin.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.codeassassin.com</link>
	<description>Silently disposing your objects in the dead of night.</description>
	<lastBuildDate>Mon, 16 Jan 2012 04:14:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.codeassassin.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code Assassin</title>
		<link>http://blog.codeassassin.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.codeassassin.com/osd.xml" title="Code Assassin" />
	<atom:link rel='hub' href='http://blog.codeassassin.com/?pushpress=hub'/>
		<item>
		<title>Create a PowerShell v3 ISE Add-on Tool</title>
		<link>http://blog.codeassassin.com/2012/01/16/create-a-powershell-v3-ise-add-on-tool/</link>
		<comments>http://blog.codeassassin.com/2012/01/16/create-a-powershell-v3-ise-add-on-tool/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 23:38:27 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://jstangroome.wordpress.com/?p=302</guid>
		<description><![CDATA[Note: This process is based on PowerShell v3 CTP 2 and is subject change. When you open PowerShell v3&#8242;s ISE (Integrated Scripting Environment) you should see a new Commands pane that wasn&#8217;t present in version 2. This is a built-in example of an ISE Add-on Tool but you can also create your own quite easily. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=302&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>Note: This process is based on PowerShell v3 CTP 2 and is subject change.</em></p>
<p>When you open PowerShell v3&#8242;s ISE (Integrated Scripting Environment) you should see a new Commands pane that wasn&#8217;t present in version 2.</p>
<p><a href="http://jstangroome.files.wordpress.com/2012/01/commands-pane.png"><img class="alignnone size-full wp-image-303" title="Commands pane" src="http://jstangroome.files.wordpress.com/2012/01/commands-pane.png?w=595" alt=""   /></a></p>
<p>This is a built-in example of an ISE Add-on Tool but you can also create your own quite easily. At its simplest an ISE Add-on Tool is a WPF Control that implements the <a href="http://msdn.microsoft.com/en-us/library/microsoft.powershell.host.ise.iaddontoolhostobject(v=vs.85).aspx">IAddOnToolHostObject </a>interface. To get started writing your own add-on follow these simple steps:</p>
<ol>
<li>Open Visual Studio and create a new WPF User Control Library project. The new project should contain a new UserControl1.</li>
<li>Add a new Project Reference to the Microsoft.PowerShell.GPowerShell (version 3.0) assembly located in the GAC.</li>
<li>Open the UserControl1.xaml.cs code-behind file and change the UserControl1 class to implement the IAddOnToolHostObject interface.</li>
<li>The only member of this interface is the HostObject property which can be declared a a simple auto-property for now.</li>
<li>Build the project and find the path of the DLL it produces.</li>
<li>Open the PowerShell v3 ISE and load the DLL you have just built, eg:<br />
Add-Type -Path &#8216;c:\users\me\documents\project1\bin\debug\project1.dll&#8217;</li>
<li>Add the UserControl to the current PowerShell tab&#8217;s VerticalAddOnTools collection and make it visible (replace &#8220;Project1.UserControl1&#8243; below with the full namespace of your control):<br />
$psISE.CurrentPowerShellTab.VerticalAddOnTools.Add(&#8216;MyAddOnTool&#8217;, [Project1.UserControl1], $true)</li>
</ol>
<p>After following these steps you should see a new, blank pane as an extra tab where the Commands pane normally appears and now you can return to Visual Studio and start adding to the appearance and behaviour of your new add-on tool. There are some other things worth knowing about developing ISE Add-On Tools:</p>
<ul>
<li>When your UserControl is added to the ISE, the HostObject property is set to an object almost identical to the <a href="http://technet.microsoft.com/en-us/library/dd819500.aspx">$psISE</a> variable and your control uses this to interact with the ISE itself. For example you can manipulate text in the editor, or you can register for events that tell your control when a new file is opened.</li>
<li>While your UserControl is loaded in the ISE, you cannot build in Visual Studio because the DLL is locked and you need to close the ISE to unlock the file. I recommend adding a small PowerShell script to your project that performs steps 6 and 7 above and change your project&#8217;s Debug options in Visual Studio so that the ISE is started and your script is opened when you press F5.</li>
<li>In step 7 above, your control is added to the VerticalAddOnTools collection but there is also a HorizontalAddOnTools collection and the user can move your control between these two at any time via the ISE menus so make sure you design the appearance of your Add-On Tool to work in both orientations.</li>
</ul>
<p>Alternatively the <a href="http://showui.codeplex.com/">Show-UI module</a> for PowerShell includes a ConvertTo-ISEAddOn cmdlet to create the necessary WPF objects natively from PowerShell and avoid the need for a Visual Studio project.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/302/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=302&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2012/01/16/create-a-powershell-v3-ise-add-on-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>

		<media:content url="http://jstangroome.files.wordpress.com/2012/01/commands-pane.png" medium="image">
			<media:title type="html">Commands pane</media:title>
		</media:content>
	</item>
		<item>
		<title>Build Azure projects without installing the Azure SDK on your build server</title>
		<link>http://blog.codeassassin.com/2011/12/19/build-azure-projects-without-installing-the-azure-sdk-on-your-build-server/</link>
		<comments>http://blog.codeassassin.com/2011/12/19/build-azure-projects-without-installing-the-azure-sdk-on-your-build-server/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 07:29:55 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[MSBuild]]></category>
		<category><![CDATA[Nuget]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=293</guid>
		<description><![CDATA[In general, an automated build server should be usable to build multiple projects and multiple revisions of a single project. An automated build server should also be disposable, it should not contain any special configuration that isn&#8217;t already tracked in source control, and provisioning a new build server should not require hunting for the installers [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=293&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In general, an automated build server should be usable to build multiple projects and multiple revisions of a single project. An automated build server should also be disposable, it should not contain any special configuration that isn&#8217;t already tracked in source control, and provisioning a new build server should not require hunting for the installers for specific versions of dependencies.</p>
<p>By default however, the Windows Azure SDK for .NET doesn&#8217;t work this way. To build an Azure project from a build server you need the full SDK installed and suddenly this means the build server is tied to only building projects targeting a specific version of the Azure SDK. If several projects share a single build server then all projects need to be upgraded to the new SDK when one project is upgraded and performing builds on maintenance branches becomes difficult if not impossible.</p>
<p>Simply copying some Azure SDK files into a source-controlled &#8220;Dependencies&#8221; folder won&#8217;t help much either because the (v1.6) build scripts make some assumptions:</p>
<ul>
<li>The Azure tools are located at a fixed path under the Program Files folder</li>
<li>The Azure SDK is located at a path referred to by a HKEY_LOCAL_MACHINE Registry key</li>
<li>A common .targets file has been installed in the MSBuild extensions folder so <em>every</em> project system-wide references it automatically</li>
</ul>
<p>Finding and fixing these assumptions is required so that a source-controlled copy of the SDK will work but these assumptions can change (and have changed) in each new version of the SDK so it is important not to be tempted to edit the original files but instead utilise the various hook points in MSBuild to override these assumptions.</p>
<p>Ideally the Azure SDK would just be a Nuget package but until the product team can be convinced to do this, I have published some scripts which allow you to build your own Nuget package of the Azure SDK with all the afore mentioned assumptions fixed. My scripts require a machine with the SDK already installed because I doubt I have the rights to redistribute original files.</p>
<p>The<a href="https://bitbucket.org/jstangroome/windowsazurenugetpackage"> scripts are available in a Mercurial repository hosted on Bitbucket</a>. After cloning or downloading a copy of the repository, just run MSBuild in the root and it will gather the necessary SDK files from your system and produce a Nuget package in the &#8220;output&#8221; subfolder. From there you <em>might ideally</em> install the package in your Azure project (the *.ccproj file) using this command from the Package Manager Console:</p>
<p><code>Install-Package -Id Microsoft.WindowsAzure -Source [path to the "output" subfolder]</code></p>
<p>Unfortunately, at the time of writing this Nuget (also v1.6) doesn&#8217;t support Azure projects so slightly more work is required. First, install the package into the target solution&#8217;s &#8220;packages&#8221; folder using the &#8220;nuget.exe&#8221; command-line interface:</p>
<p><code>nuget.exe install Microsoft.WindowsAzure -Source [path to the "output" subfolder] -OutputDirectory [path to the solution "packages" folder]</code></p>
<p>The open the Azure project&#8217;s &#8220;.ccproj&#8221; file for editing in a text editor and add the following line immediately after the opening &lt;Project &#8230; &gt; element:</p>
<p><code>&lt;Import Project="..\packages\Microsoft.WindowsAzure.1.6\tools\Microsoft.WindowsAzure.Nuget.targets" /&gt;</code></p>
<p>Note that the relative path to the &#8220;.Nuget.targets&#8221; file may be slightly different depending upon project and solution directory structures. You can<a href="http://nuget.codeplex.com/workitem/1343"> vote to get Azure support added to Nuget here</a>.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/azure/'>Azure</a>, <a href='http://blog.codeassassin.com/category/msbuild/'>MSBuild</a>, <a href='http://blog.codeassassin.com/category/nuget/'>Nuget</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/293/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=293&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2011/12/19/build-azure-projects-without-installing-the-azure-sdk-on-your-build-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Queue another Team Build when one Team Build succeeds</title>
		<link>http://blog.codeassassin.com/2011/09/06/queue-another-team-build-when-one-team-build-succeeds/</link>
		<comments>http://blog.codeassassin.com/2011/09/06/queue-another-team-build-when-one-team-build-succeeds/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 06:26:46 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=279</guid>
		<description><![CDATA[I have seen several Team Foundation Server environments where multiple build definitions exist in a single project and need to executed in a particular order. Two common techniques to achieve this are: Queue all the builds immediately and rely upon using a single build agent to serialize the builds. This approach prevents parallelization for improved [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=279&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have seen several Team Foundation Server environments where multiple build definitions exist in a single project and need to executed in a particular order. Two common techniques to achieve this are:</p>
<ul>
<li>Queue all the builds immediately and rely upon using a single build agent to serialize the builds. This approach prevents parallelization for improved build times and continues to build subsequent builds even when one fails.</li>
<li>Check build artifact(s) into source control at the end of the build and let this trigger subsequent builds configured for Continuous Integration. This approach can complicate build definition workspaces and committing build artifacts to the same repository as code is not generally recommended.</li>
</ul>
<p>As an alternative I have developed a simple customization to TFS 2010&#8242;s default build process template (the DefaultTemplate.xaml file in the BuildProcessTemplates source control folder) that allows a build definition to specify the names of subsequent builds to queue upon success. It only requires two minor changes to the Xaml file. The first is a line inserted immediately before the closing &lt;/x:Members&gt; element near the top of the file:</p>
<pre>    &lt;x:Property Name="BuildChain" Type="InArgument(s:String[])" /&gt;</pre>
<p>The second is a block inserted immediately before the final closing &lt;/Sequence&gt; at the end of the file</p>
<pre>    &lt;If Condition="[BuildChain IsNot Nothing AndAlso BuildChain.Length &amp;gt; 0]" DisplayName="If BuildChain defined"&gt;
      &lt;If.Then&gt;
        &lt;If Condition="[BuildDetail.CompilationStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Succeeded]" DisplayName="If this build succeeded"&gt;
          &lt;If.Then&gt;
            &lt;Sequence&gt;
              &lt;Sequence.Variables&gt;
                &lt;Variable x:TypeArguments="mtbc:IBuildServer" Default="[BuildDetail.BuildDefinition.BuildServer]" Name="BuildServer" /&gt;
              &lt;/Sequence.Variables&gt;
              &lt;ForEach x:TypeArguments="x:String" DisplayName="For Each build in BuildChain" Values="[BuildChain]"&gt;
                &lt;ActivityAction x:TypeArguments="x:String"&gt;
                  &lt;ActivityAction.Argument&gt;
                    &lt;DelegateInArgument x:TypeArguments="x:String" Name="buildChainItem" /&gt;
                  &lt;/ActivityAction.Argument&gt;
                  &lt;Sequence DisplayName="Queue chained build"&gt;
                    &lt;Sequence.Variables&gt;
                      &lt;Variable Name="ChainedBuildDefinition" x:TypeArguments="mtbc:IBuildDefinition" Default="[BuildServer.GetBuildDefinition(BuildDetail.TeamProject, buildChainItem)]"/&gt;
                      &lt;Variable  Name="QueuedChainedBuild" x:TypeArguments="mtbc:IQueuedBuild" Default="[BuildServer.QueueBuild(ChainedBuildDefinition)]"/&gt;
                    &lt;/Sequence.Variables&gt;
                    &lt;mtbwa:WriteBuildMessage Message="[String.Format(&amp;quot;Queued chained build '{0}'&amp;quot;, buildChainItem)]" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" /&gt;
                  &lt;/Sequence&gt;
                &lt;/ActivityAction&gt;
              &lt;/ForEach&gt;
            &lt;/Sequence&gt;
          &lt;/If.Then&gt;
        &lt;/If&gt;
      &lt;/If.Then&gt;
    &lt;/If&gt;</pre>
<p>You can see the resulting <a href="https://gist.github.com/1196590/">DefaultTemplate.xaml file here</a>. After applying these changes and checking-in the build process template file you can specify which builds to queue upon success via the Edit Build Definition windows in Visual Studio:</p>
<p><a href="http://jstangroome.files.wordpress.com/2011/09/capture.png"><img class="alignnone size-full wp-image-283" title="Edit Build Definition" src="http://jstangroome.files.wordpress.com/2011/09/capture.png?w=595" alt="The new BuildChain build process parameter"   /></a></p>
<p>You can specify the names of multiple Build Definitions from the same Team Project each on a separate line. When the first build completes successfully, all builds listed in the BuildChain property will then be queued in parallel and processed by the available Build Agents. No checking is currently done for circular dependencies so be careful not to chain a build to itself directly or indirectly and create an endless loop.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/tfs/'>TFS</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/279/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=279&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2011/09/06/queue-another-team-build-when-one-team-build-succeeds/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>

		<media:content url="http://jstangroome.files.wordpress.com/2011/09/capture.png" medium="image">
			<media:title type="html">Edit Build Definition</media:title>
		</media:content>
	</item>
		<item>
		<title>Fail a build when the warning count increases</title>
		<link>http://blog.codeassassin.com/2011/03/28/fail-a-build-when-the-warning-count-increases/</link>
		<comments>http://blog.codeassassin.com/2011/03/28/fail-a-build-when-the-warning-count-increases/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 22:28:44 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=262</guid>
		<description><![CDATA[I like to set the &#8220;Treat warnings as errors&#8221; option in all my Visual Studio projects to &#8220;All&#8221; to ensure that the code stays as clean and maintainable as possible and issues that may not be noticed until runtime are instead discovered at compile time. However, on existing projects with a large number of compiler [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=262&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I like to set the &#8220;Treat warnings as errors&#8221; option in all my Visual Studio projects to &#8220;All&#8221; to ensure that the code stays as clean and maintainable as possible and issues that may not be noticed until runtime are instead discovered at compile time. However, on existing projects with a large number of compiler warnings already present in the code base, turning this option on will immediately fail all the CI builds and either create a lot of work for the team before the builds are passing again or the team will start ignoring the failed builds. Neither is a desirable situation.</p>
<p>On the other hand, unless someone is actively monitoring the warnings and notifying the team when new compile warnings are introduced, the technical debt is just going to increase. To address this I thought it would be useful to extend the default build process template in TFS 2010 to compare the current build&#8217;s warning count with the warning count from the previous build and fail the build if the number of warnings has increased. The Xaml required for this can be<a href="https://gist.github.com/889708"> found here</a>. Hopefully this strategy will result in the team slowly decreasing the warning count down to zero and then the &#8220;Treat warnings as errors&#8221; option can be enabled to prevent new compiler warnings being introduced to the code base.</p>
<p>At the moment this is a very naive implementation &#8211; if an increase in warnings fails one build, subsequent builds will pass unless the warning count increases again. I have two ideas for improving this:</p>
<ol>
<li>Compare the current warning count against the minimum warning count of all previous builds.</li>
<li>Fail if the minimum warning count has not decreased within a specified time period (eg two weeks).</li>
</ol>
<p>If I implement either of these two ideas, I&#8217;ll update this post but they should both be quite easy to do-it-yourself.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/tfs/'>TFS</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/262/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=262&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2011/03/28/fail-a-build-when-the-warning-count-increases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Executing individual PowerShell commands using .NET 4</title>
		<link>http://blog.codeassassin.com/2011/03/23/executing-individual-powershell-commands-using-net-4/</link>
		<comments>http://blog.codeassassin.com/2011/03/23/executing-individual-powershell-commands-using-net-4/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 09:34:27 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=255</guid>
		<description><![CDATA[One of the many great things about PowerShell is that it can utilise the .NET framework directly and third party .NET libraries whenever PowerShell doesn&#8217;t offer a native solution. However, the PowerShell console, the Integrated Scripting Environment (ISE) and PS-Remoting in PowerShell 2.0 are all built for use with .NET 2.0 through to .NET 3.5. With [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=255&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the many great things about PowerShell is that it can utilise the .NET framework directly and third party .NET libraries whenever PowerShell doesn&#8217;t offer a native solution. However, the PowerShell console, the Integrated Scripting Environment (ISE) and PS-Remoting in PowerShell 2.0 are all built for use with .NET 2.0 through to .NET 3.5. With the release of version 4 of the .NET Framework though, there is an increasing amount of core functionality and third-party assemblies that are not accessible from PowerShell — the new <a href="http://msdn.microsoft.com/en-us/library/system.environment.is64bitoperatingsystem.aspx">Is64BitOperatingSystem property</a> on the System.Environment class is a simple example.</p>
<p>So, given that .NET 4 has excellent support for being able to run most .NET 2 assemblies but PowerShell doesn&#8217;t have officially support for .NET 4 yet, how can we safely utilise new .NET 4 functionality from PowerShell without waiting for a new PowerShell release from Microsoft? A quick search of the web will reveal a few different approaches, each with their own major drawbacks:</p>
<ul>
<li>Change the system-wide registry setting to load all .NET 2 assemblies under .NET 4 instead for all .NET applications.</li>
<li>Change the system-wide config files for the PowerShell console, ISE, and Remoting service to use .NET 4 instead for all PowerShell sessions.</li>
<li>Build a small .NET 4 application to host a PowerShell Runspace in-process as .NET 4.</li>
</ul>
<p>These options are either have too wide an effect or vary too much from the standard PowerShell experience for me to adopt. What if there was a way, from inside a standard PowerShell 2 session to execute a single command, script block, or script under .NET 4 without touching any upfront configuration, without requiring elevated permissions, and without affecting anything else on the system?</p>
<p>This solution is available in the form of the new <a href="http://msdn.microsoft.com/en-us/library/ff361644.aspx">Activation Configuration Files</a> feature also introduced in .NET Framework 4.0. By dynamically creating a small config file in a temporary directory then setting a process-scoped environment variable we can easily start a new .NET 4 PowerShell session passing in a ScriptBlock and some arguments and receive the same deserialized objects in return as you would see when using Remoting.</p>
<p>I&#8217;ve implemented my first version of this technique as <a href="https://gist.github.com/882528">a PowerShell script module available on Gist.GitHub</a>. It includes an Invoke-CLR4PowerShellCommand Cmdlet which behaves just like a very simple version of the built-in Invoke-Command Cmdlet. The module also includes a Test-CLR4PowerShell function demonstrating basic use of the module.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/255/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=255&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2011/03/23/executing-individual-powershell-commands-using-net-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Fail a Lab build when the environment is in use</title>
		<link>http://blog.codeassassin.com/2010/09/23/fail-a-lab-build-when-the-environment-is-in-use/</link>
		<comments>http://blog.codeassassin.com/2010/09/23/fail-a-lab-build-when-the-environment-is-in-use/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 08:23:59 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=237</guid>
		<description><![CDATA[Microsoft Test Manager in Team Foundation Server 2010 enables users to mark a lab environment as &#8220;in use&#8221; with their name, time stamp, and a comment. Other people can then see this and contact the user first if they&#8217;d also like to test, redeploy or otherwise interrupt a lab environment. However, if a user manually [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=237&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-238 alignright" title="Mark In Use" src="http://jstangroome.files.wordpress.com/2010/09/markinuse.png?w=595" alt="Screenshot of how to mark a lab environment as &quot;in use&quot;."   />Microsoft Test Manager in Team Foundation Server 2010 enables users to mark a lab environment as &#8220;in use&#8221; with their name, time stamp, and a comment.</p>
<p>Other people can then see this and contact the user first if they&#8217;d also like to test, redeploy or otherwise interrupt a lab environment.</p>
<p><a href="http://jstangroome.files.wordpress.com/2010/09/markedinuse.png"><img class="alignnone size-full wp-image-239" title="Marked &quot;In Use&quot;" src="http://jstangroome.files.wordpress.com/2010/09/markedinuse.png?w=595" alt="Screenshot of a lab environment marked as &quot;In Use&quot;"   /></a></p>
<p>However, if a user manually queues a Lab build from Visual Studio Team Explorer, or a Lab build is triggered by a schedule or a check-in, this marker is not visible and the Lab build will execute, redeploying the environment and most likely upsetting the user who was already using the environment.</p>
<p>As a solution to this, I have modified the default lab build process template to include a new parameter to specify whether the build should fail if the environment has been marked as &#8220;in use&#8221;.</p>
<p><a href="http://jstangroome.files.wordpress.com/2010/09/parameters.png"><img class="alignnone size-full wp-image-240" title="Fail If Environment Is In Use parameter" src="http://jstangroome.files.wordpress.com/2010/09/parameters.png?w=595&#038;h=141" alt="Screenshot of the added build process parameter" width="595" height="141" /></a></p>
<p>Thankfully, most of the hard work has already been done in the form of the out-of-the-box Workflow activities for Lab Management, and I just needed to add a small chunk of XAML to the existing LabDefaultTemplate.xaml file in my Team Project&#8217;s &#8220;BuildProcessTemplates&#8221; source control folder. The<a href="http://gist.github.com/593319"> full customised template is here</a>, but the core of the change was this simple code:</p>
<p><a href="http://jstangroome.files.wordpress.com/2010/09/code.png"><img class="alignnone size-full wp-image-242" title="code" src="http://jstangroome.files.wordpress.com/2010/09/code.png?w=595&#038;h=190" alt="" width="595" height="190" /></a></p>
<p>And now the lab build will fail when the environment is marked &#8220;in use&#8221;&#8230;</p>
<p><a href="http://jstangroome.files.wordpress.com/2010/09/failed.png"><img class="alignnone size-full wp-image-243" title="failed" src="http://jstangroome.files.wordpress.com/2010/09/failed.png?w=595" alt=""   /></a></p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/tfs/'>TFS</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/237/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=237&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/09/23/fail-a-lab-build-when-the-environment-is-in-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>

		<media:content url="http://jstangroome.files.wordpress.com/2010/09/markinuse.png" medium="image">
			<media:title type="html">Mark In Use</media:title>
		</media:content>

		<media:content url="http://jstangroome.files.wordpress.com/2010/09/markedinuse.png" medium="image">
			<media:title type="html">Marked &#34;In Use&#34;</media:title>
		</media:content>

		<media:content url="http://jstangroome.files.wordpress.com/2010/09/parameters.png" medium="image">
			<media:title type="html">Fail If Environment Is In Use parameter</media:title>
		</media:content>

		<media:content url="http://jstangroome.files.wordpress.com/2010/09/code.png" medium="image">
			<media:title type="html">code</media:title>
		</media:content>

		<media:content url="http://jstangroome.files.wordpress.com/2010/09/failed.png" medium="image">
			<media:title type="html">failed</media:title>
		</media:content>
	</item>
		<item>
		<title>Query all file references in a Visual Studio solution with PowerShell</title>
		<link>http://blog.codeassassin.com/2010/08/30/query-all-file-references-in-a-visual-studio-solution-with-powershell/</link>
		<comments>http://blog.codeassassin.com/2010/08/30/query-all-file-references-in-a-visual-studio-solution-with-powershell/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 09:52:06 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=231</guid>
		<description><![CDATA[Today I was working on introducing Continuous Integration to a legacy code base and was discovering the hard way that the solution of about 20 projects had many conflicting references to external assemblies. Some assemblies were different versions, others the same version but in different paths, and others completely missing altogether. Needless to say this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=231&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I was working on introducing Continuous Integration to a legacy code base and was discovering the hard way that the solution of about 20 projects had many conflicting references to external assemblies. Some assemblies were different versions, others the same version but in different paths, and others completely missing altogether. Needless to say this wasn&#8217;t going to build cleanly on a build server.</p>
<p>Rather than manually checking the path and version of every assembly referenced by every project in the solution, I wrote a PowerShell script to parse a Visual Studio 2010 solution file, identify all the projects, then parse the project files for the reference information. The resulting <a href="http://gist.github.com/557222">Get-VSSolutionReferences.ps1 script is available on GitHub</a>.</p>
<p>Once I had a collection of objects representing all the assembly references I could perform some interesting analysis. Here is a really basic example of how to list all the assemblies referenced by two or more projects:</p>
<pre>$Refs = &amp; .\Get-VSSolutionReferences.ps1 MySolution.sln
$Refs | group Name | ? { $_.Count -ge 2 }</pre>
<p>It doesn&#8217;t take much more to find version mismatches or files that don&#8217;t exist at the specified paths, but I&#8217;ll leave that as an exercise for you, the reader.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>, <a href='http://blog.codeassassin.com/category/visual-studio/'>Visual Studio</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/231/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=231&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/08/30/query-all-file-references-in-a-visual-studio-solution-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Import a Gist into your PowerShell ISE profile</title>
		<link>http://blog.codeassassin.com/2010/08/12/import-a-gist-into-your-powershell-ise-profile/</link>
		<comments>http://blog.codeassassin.com/2010/08/12/import-a-gist-into-your-powershell-ise-profile/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 15:12:38 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=222</guid>
		<description><![CDATA[I realised a few hours after posting my last entry about a PowerShell ISE profile script, that I failed to describe to people new to the ISE environment, how to include the script as part of their ISE profile so it is always available. Simply explaining how to determine the path of your ISE profile [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=222&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I realised a few hours after posting <a href="http://blog.codeassassin.com/2010/08/11/automatic-tfs-check-out-for-powershell-ise/">my last entry</a> about a PowerShell ISE profile script, that I failed to describe to people new to the ISE environment, how to include the script as part of their ISE profile so it is always available.</p>
<p>Simply explaining how to determine the path of your ISE profile by checking the value of the $Profile variable from within the ISE would be boring, so instead I wrote another script to automatically download the first script from <a href="https://github.com/">GitHub</a>, and add it to your profile.</p>
<p>This <a href="http://gist.github.com/519103">new script</a> can simply be copied and pasted into the ISE&#8217;s Command Pane (Ctrl+D) and your profile will be opened and updated, ready to be saved. Once saved, you can either restart the ISE or simply run &#8221; . $profile &#8221; (without quotes) from the Command Pane.</p>
<p>You will hopefully notice in this new script, that my usual attention to neatness and verbosity has been replaced with terseness due to the purpose of this script being a use once and throw away item. I had considered writing it as a single line but quickly regained my senses.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/222/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=222&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/08/12/import-a-gist-into-your-powershell-ise-profile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Automatic TFS Check Out for PowerShell ISE</title>
		<link>http://blog.codeassassin.com/2010/08/11/automatic-tfs-check-out-for-powershell-ise/</link>
		<comments>http://blog.codeassassin.com/2010/08/11/automatic-tfs-check-out-for-powershell-ise/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 08:13:56 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=216</guid>
		<description><![CDATA[I work with a lot of PowerShell scripts, it&#8217;s the fun part of my job. I do most of my editing using the PowerShell ISE, primarily because it is the default, but also because it has great syntax highlighting, tab completion, and debug support. Additionally, all of my scripts are in source control: sometimes Mercurial, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=216&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I work with a lot of PowerShell scripts, it&#8217;s the fun part of my job. I do most of my editing using the <a href="http://technet.microsoft.com/en-us/library/dd315244.aspx">PowerShell ISE</a>, primarily because it is <a href="http://www.useit.com/alertbox/defaults.html">the default</a>, but also because it has great syntax highlighting, tab completion, and debug support. Additionally, all of my scripts are in source control: sometimes <a href="http://mercurial.selenic.com/">Mercurial</a>, occasionally <a href="http://git-scm.com/">Git</a>, but mostly <a href="http://msdn.microsoft.com/en-us/vstudio/ff637362.aspx">Team Foundation Server</a> (TFS).</p>
<p>The way TFS works though, is that all files in your local workspace are marked as read-only until you Check-Out for editing. When working on TFS-managed files in Visual Studio, the check-out is done automatically as soon as you begin typing in the editor. The PowerShell ISE however has no idea about TFS and will let you edit to your heart&#8217;s content until you eventually try to save your changes and it fails due to the read-only flag.</p>
<p>But I&#8217;ve developed a solution&#8230;</p>
<p>I&#8217;ve written a <a href="http://gist.github.com/518638">PowerShell ISE-specific profile script</a> that performs a few simple things:</p>
<ol>
<li>Checks if you have the TFS client installed (eg Team Explorer).</li>
<li>Registers for ISE events on each open file and any files you open later.</li>
<li>Upon editing of a file, if it is TFS-managed then checks it out.</li>
</ol>
<p>The end result is the same TFS workflow experience from within the PowerShell ISE as Visual Studio provides.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>, <a href='http://blog.codeassassin.com/category/tfs/'>TFS</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=216&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/08/11/automatic-tfs-check-out-for-powershell-ise/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Create SCVMM Templates with PowerShell</title>
		<link>http://blog.codeassassin.com/2010/08/03/create-scvmm-templates-with-powershell/</link>
		<comments>http://blog.codeassassin.com/2010/08/03/create-scvmm-templates-with-powershell/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 12:32:06 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SCVMM]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=207</guid>
		<description><![CDATA[Now that I get to work with a TFS 2010 Lab Management environment most days, I find myself building various virtual machines to replicate the  production environments of our clients for testing. With many different clients and projects, the range of virtual machine operating systems expands exponentially as matrix of core OS version, processor architecture, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=207&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Now that I get to work with a TFS 2010 Lab Management environment most days, I find myself building various virtual machines to replicate the  production environments of our clients for testing. With many different clients and projects, the range of virtual machine operating systems expands exponentially as matrix of core OS version, processor architecture, service pack, IE version, and other minor variations. However, for any particular configuration, I&#8217;ll also want multiple copies so naturally I want to make use of System Center Virtual Machine Manager&#8217;s VM Template Library.</p>
<p>However, creating a template from a VM using the SCVMM Administrator Console, without destroying the original VM, is death by a thousand clicks:</p>
<ol>
<li>Shutdown the VM.</li>
<li>Dismount any media in the VM&#8217;s virtual DVD drives.</li>
<li>Clone the VM via an eight-page wizard.</li>
<li>Wait for the cloning to complete.</li>
<li>Convert the cloned VM into a template with a six-page wizard.</li>
<li>Wait for the sysprepping to complete.</li>
<li>Restart the original VM.</li>
</ol>
<p>I tire of such tedium very quickly and as such, I&#8217;ve scripted the above process with PowerShell and the SCVMM Snapin. You can access the <a href="http://gist.github.com/506252">Export-VMTemplate script</a> I&#8217;ve written on gist.github. If you open a PowerShell window from the toolbar in the SCVMM console, you can execute the script like this:</p>
<pre>.\Export-VMTemplate.ps1 -VM 'MyOriginalVm' -TemplateName 'NewTemplateName' -LibraryServer 'MyLibSvr'</pre>
<p>Hopefully the script itself, or at least some of the concepts within, will be useful to someone else.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>, <a href='http://blog.codeassassin.com/category/scvmm/'>SCVMM</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=207&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/08/03/create-scvmm-templates-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
	</channel>
</rss>
