<?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" >

<channel>
	<title>Even the wrong words seem to rhyme &#187; csharp</title>
	<atom:link href="http://www.kevinblake.co.uk/tag/csharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kevinblake.co.uk</link>
	<description>a blog-life by Kevin Blake</description>
	<lastBuildDate>Sat, 04 Feb 2012 19:58:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Running PowerShell to change MSBuild scripts with NuGet</title>
		<link>http://www.kevinblake.co.uk/running-powershell-to-change-msbuild-scripts-with-nuget/892/</link>
		<comments>http://www.kevinblake.co.uk/running-powershell-to-change-msbuild-scripts-with-nuget/892/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 19:58:55 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[msbuild]]></category>
		<category><![CDATA[nuget]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=892</guid>
		<description><![CDATA[One of the things I&#8217;ve missed from creating a number of NuGet packages, is not being able to add msbuild tasks to the .csproj file.  From running web.config transforms, versioning assemblies, to running unit tests, code analysis, or deployments &#8211; msbuild can add quite a lot of cherries to your builds.  In a web agency, [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I&#8217;ve missed from creating a number of NuGet packages, is not being able to add msbuild tasks to the .csproj file.  From running web.config transforms, versioning assemblies, to running unit tests, code analysis, or deployments &#8211; msbuild can add quite a lot of cherries to your builds.  In a web agency, I work with a lot of projects for fairly short periods of time, and even copying and pasting all those useful scripts means they often get missed / take too much time, or just plain break because I&#8217;ve forgotten something.</p>
<p>Re-using code still can take hours out of my project which I&#8217;d much rather be using to create something new.  Combine that with a larger team of people doing the same thing, and we need a better solution.</p>
<p>NuGet makes it very easy to install binaries or content/src files, and the <a href="http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package" target="_blank">nuspec syntax</a> is beautifully simplistic.  In it&#8217;s absolute barest form, it looks a little like this:</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;package</span> <span class="re0">xmlns</span>=<span class="st0">&quot;http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd&quot;</span><span class="re2">&gt;</span></span>
  <span class="sc3"><span class="re1">&lt;metadata<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;id<span class="re2">&gt;</span></span></span>VersionAssembly.Mvc<span class="sc3"><span class="re1">&lt;/id<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;version<span class="re2">&gt;</span></span></span>1.6<span class="sc3"><span class="re1">&lt;/version<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;authors<span class="re2">&gt;</span></span></span>Kevin Blake<span class="sc3"><span class="re1">&lt;/authors<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;description<span class="re2">&gt;</span></span></span>Version Assembly<span class="sc3"><span class="re1">&lt;/description<span class="re2">&gt;</span></span></span>
  <span class="sc3"><span class="re1">&lt;/metadata<span class="re2">&gt;</span></span></span>
  <span class="sc3"><span class="re1">&lt;files<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;file</span> <span class="re0">src</span>=<span class="st0">&quot;VersionController.cs.pp&quot;</span> <span class="re0">target</span>=<span class="st0">&quot;content\Controllers&quot;</span> <span class="re2">/&gt;</span></span>
  <span class="sc3"><span class="re1">&lt;/files<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/package<span class="re2">&gt;</span></span></span></pre></div></div>
<p>That doesn&#8217;t look like very much, but when we create a NuGet package (nuget.exe pack .), we&#8217;re going to get a package that will install a new controller, and the .pp file extensions means that file will be processed to include the correct namespace for our project.  In this case, the controller just outputs the assembly version number &#8211; but that&#8217;s not important.</p>
<p>We can also add dll&#8217;s to this, with target=&#8221;lib&#8221;, for all those libraries you&#8217;ve got hanging around on your server.  More excitingly, you can run PowerShell scripts along with your NuGet install, by using target=&#8221;tools\install.pl1&#8243;.  PowerShell is a very powerful scripting language from Microsoft (yep, another one), which among many other things, can give your NuGet packages all the extra power to do what you like&#8230;</p>
<p>Let&#8217;s start off with a really basic script that&#8217;ll run while installing your package by adding to your &lt;files&gt; node within your nuspec.</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;file</span> <span class="re0">src</span>=<span class="st0">&quot;install.ps1&quot;</span> <span class="re0">target</span>=<span class="st0">&quot;tools\install.ps1&quot;</span> <span class="re2">/&gt;</span></span></pre></div></div>
<p>Note that you can <strong><em>only</em></strong> have an install script if you&#8217;ve already got a content or lib file in there as well.  So go and add one (even a <em>package</em>_readme.txt) if you haven&#8217;t already.  You <em>can</em> also use init.ps1 instead, but that&#8217;s going to run every time your project loads.  For our sake, the controller we already have does the job just fine.</p>
<p>Now you&#8217;re going to need a PowerShell script, so let&#8217;s start out small with Hello World.</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="c" style="font-family:monospace;">Write<span class="sy0">-</span>Host <span class="st0">&quot;Hello World&quot;</span></pre></div></div>
<p>You can probably guess that this won&#8217;t do very much, but you should be able to see that output when you install you NuGet package.  You also have at your command, your simplest form of echo/print debugging tool, for PowerShell beginners like me.</p>
<p>With that working, you can move onto something a little more useful&#8230; The following script will add a Version task to your .csproj file, which updates the Properties\AssemblyInfo.cs with the version number that (in our case) comes from CruiseControl.Net.  Most of the work for this task comes with the <a href="http://msbuildtasks.tigris.org/" target="_blank">MSBuild Community Tasks</a>, so you will need that installed if you&#8217;re going to try this out word-for-word.</p>
<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="c" style="font-family:monospace;">param<span class="br0">&#40;</span>$installPath<span class="sy0">,</span> $toolsPath<span class="sy0">,</span> $package<span class="sy0">,</span> $project<span class="br0">&#41;</span>
&nbsp;
$buildProject <span class="sy0">=</span> Get<span class="sy0">-</span>MSBuildProject
$import <span class="sy0">=</span> $buildProject.<span class="me1">Xml</span>.<span class="me1">AddImport</span><span class="br0">&#40;</span><span class="st0">&quot;`$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets&quot;</span><span class="br0">&#41;</span>
$target <span class="sy0">=</span> $buildProject.<span class="me1">Xml</span>.<span class="me1">AddTarget</span><span class="br0">&#40;</span><span class="st0">&quot;Version&quot;</span><span class="br0">&#41;</span>
&nbsp;
$target.<span class="me1">BeforeTargets</span> <span class="sy0">=</span> <span class="st0">&quot;BeforeBuild&quot;</span>
$target.<span class="me1">Condition</span> <span class="sy0">=</span> <span class="st0">&quot;'`$(Configuration)' == 'Release'&quot;</span>
$task <span class="sy0">=</span> $target.<span class="me1">AddTask</span><span class="br0">&#40;</span><span class="st0">&quot;AssemblyInfo&quot;</span><span class="br0">&#41;</span>
$task.<span class="me1">Condition</span> <span class="sy0">=</span> <span class="st0">&quot;'`$(CCNetLabel)' != ''&quot;</span>
$task.<span class="me1">SetParameter</span><span class="br0">&#40;</span><span class="st0">&quot;CodeLanguage&quot;</span><span class="sy0">,</span> <span class="st0">&quot;CS&quot;</span><span class="br0">&#41;</span>
$task.<span class="me1">SetParameter</span><span class="br0">&#40;</span><span class="st0">&quot;OutputFile&quot;</span><span class="sy0">,</span> <span class="st0">&quot;properties<span class="es1">\A</span>ssemblyInfo.cs&quot;</span><span class="br0">&#41;</span>
$task.<span class="me1">SetParameter</span><span class="br0">&#40;</span><span class="st0">&quot;AssemblyVersion&quot;</span><span class="sy0">,</span> <span class="st0">&quot;`$(CCNetLabel)&quot;</span><span class="br0">&#41;</span>
$task.<span class="me1">SetParameter</span><span class="br0">&#40;</span><span class="st0">&quot;AssemblyFileVersion&quot;</span><span class="sy0">,</span> <span class="st0">&quot;`$(CCNetLabel)&quot;</span><span class="br0">&#41;</span>
&nbsp;
$buildProject.<span class="me1">Save</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
$project.<span class="me1">Save</span><span class="br0">&#40;</span><span class="br0">&#41;</span></pre></div></div>
<p>That Get-MSBuildProject statement is actually supplied by another NuGet package, so we&#8217;ll have to change our NuSpec file to include that as a dependency by adding to the metadata block.</p>
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;dependencies<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;dependency</span> <span class="re0">id</span>=<span class="st0">&quot;NuGetPowerTools&quot;</span> <span class="re0">version</span>=<span class="st0">&quot;0.26&quot;</span> <span class="re2">/&gt;</span></span>
    <span class="sc3"><span class="re1">&lt;/dependencies<span class="re2">&gt;</span></span></span></pre></div></div>
<p>It&#8217;s also a good idea to add an uninstall.ps1 script that will undo all of those changes if someone later decides not to use your package.  I&#8217;m not going to cover that here because it&#8217;s not something I&#8217;ve completed, and these packages will not be publicly posted (by all means, share your examples in the comments, if you have).</p>
<p>Your complete NuSpec file should now look a little bit like this</p>
<div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;package</span> <span class="re0">xmlns</span>=<span class="st0">&quot;http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd&quot;</span><span class="re2">&gt;</span></span>
  <span class="sc3"><span class="re1">&lt;metadata<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;id<span class="re2">&gt;</span></span></span>VersionAssembly.Mvc<span class="sc3"><span class="re1">&lt;/id<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;version<span class="re2">&gt;</span></span></span>1.6<span class="sc3"><span class="re1">&lt;/version<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;authors<span class="re2">&gt;</span></span></span>Kevin Blake<span class="sc3"><span class="re1">&lt;/authors<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;description<span class="re2">&gt;</span></span></span>Version assemblies<span class="sc3"><span class="re1">&lt;/description<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;dependencies<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;dependency</span> <span class="re0">id</span>=<span class="st0">&quot;NuGetPowerTools&quot;</span> <span class="re0">version</span>=<span class="st0">&quot;0.26&quot;</span> <span class="re2">/&gt;</span></span>
    <span class="sc3"><span class="re1">&lt;/dependencies<span class="re2">&gt;</span></span></span>
  <span class="sc3"><span class="re1">&lt;/metadata<span class="re2">&gt;</span></span></span>
  <span class="sc3"><span class="re1">&lt;files<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;file</span> <span class="re0">src</span>=<span class="st0">&quot;VersionController.cs.pp&quot;</span> <span class="re0">target</span>=<span class="st0">&quot;content\Controllers&quot;</span> <span class="re2">/&gt;</span></span>
    <span class="sc3"><span class="re1">&lt;file</span> <span class="re0">src</span>=<span class="st0">&quot;tools\install.ps1&quot;</span> <span class="re0">target</span>=<span class="st0">&quot;tools\install.ps1&quot;</span> <span class="re2">/&gt;</span></span>
<span class="sc3"><span class="re1">&lt;/files<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/package<span class="re2">&gt;</span></span></span></pre></div></div></pre>
<p>It&#8217;s a very simple example, I know &#8211; but these basic steps give almost limitless possibilities to your NuGet packages&#8230; Personally, I will be creating a lot more of these to include build scripts we would otherwise have had to include in a rather large bloated project template.  NuGet+PowerShell gives the flexibility to choose just what we need from the dessert cart, and that can only be a good thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/running-powershell-to-change-msbuild-scripts-with-nuget/892/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Umbraco with Web Application projects, CI, across teams</title>
		<link>http://www.kevinblake.co.uk/using-umbraco-with-web-application-projects-ci-across-teams/877/</link>
		<comments>http://www.kevinblake.co.uk/using-umbraco-with-web-application-projects-ci-across-teams/877/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 13:14:11 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[msbuild]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[umbraco]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=877</guid>
		<description><![CDATA[Can I use just a Web Site project? Yes &#8211; of course. I don&#8217;t really want to get into the debate about Web Site projects, vs. Web Application projects.  But I do want to start off by saying I dislike Web Site projects, and we&#8217;d never think about using them anywhere else. One thing they offer [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Can I use just a Web Site project?</strong></p>
<p>Yes &#8211; of course.</p>
<p>I don&#8217;t really want to get into the debate about Web Site projects, vs. Web Application projects.  But I do want to start off by saying I dislike <a href="http://msdn.microsoft.com/en-us/library/ie/dd547590.aspx" target="_blank">Web Site projects</a>, and we&#8217;d never <em>think</em> about using them anywhere else.</p>
<p>One thing they offer though, is all of the files you drop into the directory become part of your Visual Studio solution.  This is really useful for applications such as Umbraco where developers are uploading media items, adding scripts, or creating templates via the Umbraco back-end.  It&#8217;s a pain to have to switch back to Visual Studio and add those generated files to your project, just to ensure they get published with the rest of your site.</p>
<p>We use a CI server, we want repeatable deployments, we&#8217;re working in teams, we want everything that&#8217;s anything to be in source control, we want the moon on a bloody stick &#8211; and Web Site projects just don&#8217;t cut it.  But I don&#8217;t really want to even mess around with everyone having to <strong>only</strong> work in Visual Studio either, so PostBuild events on separate projects that copy in razor scripts / templates etc is also &#8211; no good.  The beautiful thing with Umbraco is it&#8217;s completely flexible, there&#8217;s no right or wrong way to use it.  So here&#8217;s how we&#8217;re (currently) managing Umbraco (v4) builds.</p>
<p><strong>Getting started with your web application</strong></p>
<p>Firstly, create a new Empty Web application project in Visual Studio.</p>
<p style="text-align: center;"><a href="http://www.kevinblake.co.uk/wp-content/uploads/2012/01/new-project.jpg" rel="lightbox"><img class="size-full wp-image-882 aligncenter" title="new-project" src="http://www.kevinblake.co.uk/wp-content/uploads/2012/01/new-project.jpg" alt="" width="434" height="107" /></a></p>
<p>Download and copy all of the files from the latest Umbraco release into your project.</p>
<div id="attachment_883" class="wp-caption alignright" style="width: 129px"><a href="http://www.kevinblake.co.uk/wp-content/uploads/2012/01/include-all-files.jpg" rel="lightbox"><img class="size-full wp-image-883" title="show all files" src="http://www.kevinblake.co.uk/wp-content/uploads/2012/01/include-all-files.jpg" alt="" width="119" height="41" /></a><p class="wp-caption-text">Don&#39;t forget the show all files button, to see everything in your directory</p></div>
<p>Now in Visual Studio, you want to add all the directories / files to your solution that you aren&#8217;t going to let people manage through Umbraco as well.  For our purposes, that&#8217;s config, data, App_Data, App_Browsers, data, umbraco, umbraco_client, default.aspx, and web.config.  If it&#8217;s still useful to have some of those other files/directories in your project later, don&#8217;t worry &#8211; you can add them (and have Umbraco/msbuild manage the rest).</p>
<p>You can add the bin folder as well, if you want &#8211; but we don&#8217;t like all binary files checked into sourcecontrol, so this is one folder we usually exclude by default.</p>
<p>If you want the same, copy all of the files out of the bin folder to a directory outside of your csproj (call it Resources, Libraries, whatever you like).  Then in Visual Studio, Right-click on your references folder, Add reference, and include all those dlls.  You&#8217;ll need that Resources / Libraries folder included in sourcecontrol as well.</p>
<p><a href="http://www.kevinblake.co.uk/wp-content/uploads/2012/01/project-tree.jpg" rel="lightbox"><img class="aligncenter size-full wp-image-885" title="project-tree" src="http://www.kevinblake.co.uk/wp-content/uploads/2012/01/project-tree.jpg" alt="" width="181" height="377" /></a></p>
<p>You now have a solution that will build and work locally.  But you still don&#8217;t have the ease of including new Umbraco-managed items in your builds (try and right-click to publish your project to the file system, and notice how you&#8217;re still missing all of your media items and masterpages).  That&#8217;s no good for our Continuous Integration server, and a Web Site project would include all those items by default (you&#8217;d need to create one of those Web Deployment project as well though).</p>
<p><strong>Modify MsBuild scripts&#8230; Include everything the wrong way</strong></p>
<p>Msbuild to the rescue.  Open your .csproj file in your favourite editor (unload the project in Visual Studio if you want to use that).</p>
<p>You&#8217;ll see a whole bunch of xml nodes like &lt;Content Include=&#8221;default.aspx&#8221;&gt;.  These tell msbuild to include these files as Content items, and copy them to the Output directory on every build.</p>
<p>You can use wildcards, so you could just add a new item such as &lt;Content Include=&#8221;masterpages\**\*.master&#8221; /&gt; and you&#8217;d think that would include everything.  And you&#8217;d be right &#8211; reload your solution in Visual Studio,  and all of those masterpages will be included.  However &#8211; exclude one file, re-add it, and save your project.  If you inspect your .csproj file again &#8211; look how helpful Visual Studio has been&#8230; It&#8217;s replaced your wildcard map with a list of individual files again.  Bad Visual Studio.</p>
<p><strong>Modify MsBuild scripts&#8230; Include everything the right way</strong></p>
<p>Since that&#8217;s clearly going to go wrong somewhere down the line, one of your developers is going to do exactly that and unknowingly bring your entire build solution crumbling to its knees &#8211; this clearly won&#8217;t do.  There is always another way.</p>
<p>We can modify the BeforeBuild event (that&#8217;s currently commented out near the bottom of your csproj file, so uncomment it and replace it with this.<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><span class="sy0">&lt;</span>Target Name<span class="sy0">=</span><span class="st0">&quot;BeforeBuild&quot;</span><span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>CreateItem Include<span class="sy0">=</span><span class="st0">&quot;macroScripts<span class="es0">\*</span>*<span class="es0">\*</span>.cshtml&quot;</span><span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>Output ItemName<span class="sy0">=</span><span class="st0">&quot;Content&quot;</span> TaskParameter<span class="sy0">=</span><span class="st0">&quot;Include&quot;</span> <span class="sy0">/&gt;</span>
<span class="sy0">&lt;/</span>CreateItem<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>CreateItem Include<span class="sy0">=</span><span class="st0">&quot;xslt<span class="es0">\*</span>*<span class="es0">\*</span>.xslt&quot;</span><span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>Output ItemName<span class="sy0">=</span><span class="st0">&quot;Content&quot;</span> TaskParameter<span class="sy0">=</span><span class="st0">&quot;Include&quot;</span> <span class="sy0">/&gt;</span>
<span class="sy0">&lt;/</span>CreateItem<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>CreateItem Include<span class="sy0">=</span><span class="st0">&quot;masterpages<span class="es0">\*</span>*<span class="es0">\*</span>.master&quot;</span><span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>Output ItemName<span class="sy0">=</span><span class="st0">&quot;Content&quot;</span> TaskParameter<span class="sy0">=</span><span class="st0">&quot;Include&quot;</span> <span class="sy0">/&gt;</span>
<span class="sy0">&lt;/</span>CreateItem<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>CreateItem Include<span class="sy0">=</span><span class="st0">&quot;media<span class="es0">\*</span>*<span class="es0">\*</span>.*&quot;</span><span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>Output ItemName<span class="sy0">=</span><span class="st0">&quot;Content&quot;</span> TaskParameter<span class="sy0">=</span><span class="st0">&quot;Include&quot;</span> <span class="sy0">/&gt;</span>
<span class="sy0">&lt;/</span>CreateItem<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>CreateItem Include<span class="sy0">=</span><span class="st0">&quot;usercontrols<span class="es0">\*</span>*<span class="es0">\*</span>.*&quot;</span><span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>Output ItemName<span class="sy0">=</span><span class="st0">&quot;Content&quot;</span> TaskParameter<span class="sy0">=</span><span class="st0">&quot;Include&quot;</span> <span class="sy0">/&gt;</span>
<span class="sy0">&lt;/</span>CreateItem<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>CreateItem Include<span class="sy0">=</span><span class="st0">&quot;css<span class="es0">\*</span>*<span class="es0">\*</span>.*&quot;</span><span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>Output ItemName<span class="sy0">=</span><span class="st0">&quot;Content&quot;</span> TaskParameter<span class="sy0">=</span><span class="st0">&quot;Include&quot;</span> <span class="sy0">/&gt;</span>
<span class="sy0">&lt;/</span>CreateItem<span class="sy0">&gt;</span>
<span class="sy0">&lt;/</span>Target<span class="sy0">&gt;</span></pre></div></div></pre>
<p>What we&#8217;re doing is adding to the Content array that msbuild&#8217;s defined with all those Content nodes.  We&#8217;re including all files from those directories in the publish, and we&#8217;re making the Web Application project work the way that Umbraco, and we want.  You can include as many of the folders as you&#8217;re comfortable with, and you can continue to work in Visual Studio for as much or as little of the sln as you want.</p>
<p><strong>Avoid doing this next time</strong></p>
<p>Having putting in this small amount of work up-front, you can now export your entire project as a project template, and use it to start off all your projects in the future.  You probably have more of a white label sln you can add to this and make your subsequent builds even easier.  I won&#8217;t get into the details of that in this post (but it&#8217;s essentially just File-Export Template within Visual Studio).</p>
<p>Like I said, Umbraco is completely flexible in the way you approach your builds, this is one solution that works for us &#8211; and there is always another way.  I&#8217;d be keen to hear your feedback / improvements / alternatives &#8211; we haven&#8217;t etched it in stone by any means.</p>
<p><strong>Similar posts that have inspired, and Another Way:</strong></p>
<ul>
<li><a href="http://blog.mattbrailsford.com/2010/11/13/automating-umbraco-package-creation-using-msbuild/" target="_blank">Creating packages with msbuild</a></li>
<li><a href="http://cjgiddings.wordpress.com/2009/04/30/setting-up-umbraco-correctly-with-msbuild/" target="_blank">Setting up Umbraco correctly with MSBuild</a></li>
<li><a href="http://our.umbraco.org/wiki/codegarden-2009/open-space-minutes/working-in-visual-studio-when-developing-umbraco-solutions" target="_blank">Using xcopy / postbuild events</a></li>
</ul>
<p>(Send me more, and I&#8217;ll add to this list)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/using-umbraco-with-web-application-projects-ci-across-teams/877/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<georss:point>0.0000000 0.0000000</georss:point>	</item>
		<item>
		<title>C# Joins with Linq and Lambdas</title>
		<link>http://www.kevinblake.co.uk/csharp-lamba-joins-in-linq/647/</link>
		<comments>http://www.kevinblake.co.uk/csharp-lamba-joins-in-linq/647/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 12:16:14 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[lambda]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=647</guid>
		<description><![CDATA[I&#8217;m always forgetting the syntax for lambda joins in C#, because I never use them enough and get bored looking for reminders enough that I just revert back my old ways and use the query expression instead. So rather than find a good tutorial and bookmark it, I&#8217;ll post it here instead. By the time [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m always forgetting the syntax for lambda joins in C#, because I never use them enough and get bored looking for reminders enough that I just revert back my old ways and use the query expression instead.  So rather than find a good tutorial and bookmark it, I&#8217;ll post it here instead.  By the time it falls off the front page, I&#8217;ll just about have remembered how to do it without needing this anyway <img src='http://www.kevinblake.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Query Syntax</strong></p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;">var products <span class="sy0">=</span> from audio <span class="kw1">in</span> DbContext.<span class="me1">DataContext</span>.<span class="me1">ProductAudios</span>
join product <span class="kw1">in</span> DbContext.<span class="me1">DataContext</span>.<span class="me1">ProductAudios</span> on audio.<span class="me1">ProductId</span> equals product.<span class="me1">ProductId</span>
select <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> <span class="br0">&#123;</span> Product <span class="sy0">=</span> product, Audio <span class="sy0">=</span> audio <span class="br0">&#125;</span><span class="sy0">;</span></pre></div></div>
<p><strong>Lambda Syntax</strong></p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;">var products <span class="sy0">=</span> DbContext.<span class="me1">DataContext</span>.<span class="me1">ProductAudios</span>.<span class="me1">Join</span><span class="br0">&#40;</span>
                DbContext.<span class="me1">DataContext</span>.<span class="me1">Products</span>,
                audio <span class="sy0">=&gt;</span> audio.<span class="me1">ProductId</span>,
                product <span class="sy0">=&gt;</span> product.<span class="me1">ProductId</span>,
                <span class="br0">&#40;</span>audio, product<span class="br0">&#41;</span> <span class="sy0">=&gt;</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> <span class="br0">&#123;</span> Product <span class="sy0">=</span> product, Audio <span class="sy0">=</span> audio <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>It might look like more code because of my formatting, but I find the lambda syntax much convenient when chaining queries together with other where&#8217;s and groupby&#8217;s, especially when that might be split across different methods.  It also isolates your join nicely, whereas I find the query syntax will start to get particularly unreadable with more complex queries.</p>
<p>Last but not least, another piece of linq-join-related syntax I&#8217;m finding myself always having to look up a lot is for left outer joins.  Fortunately I always end up at MSDN for that one, so I&#8217;ll just link to it here:<br />
<a href="http://msdn.microsoft.com/en-us/library/bb397895.aspx">How to: Perform Left Outer Joins</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/csharp-lamba-joins-in-linq/647/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Running Ruby methods within C# / .NET</title>
		<link>http://www.kevinblake.co.uk/running-ruby-methods-within-c-net/631/</link>
		<comments>http://www.kevinblake.co.uk/running-ruby-methods-within-c-net/631/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 21:16:04 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[ironruby]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=631</guid>
		<description><![CDATA[The last example might have been a little too trivial, even by my standards. Even I struggled to imagine a scenario where I might ever need to use it. So hopefully this one will be a little bit more interesting and demonstrate something more useful. Useful, but still just as simple as the previous examples, [...]]]></description>
			<content:encoded><![CDATA[<p>The last example might have been a little too trivial, even by my standards.  Even I struggled to imagine a scenario where I might ever need to use it.  So hopefully this one will be a little bit more interesting and demonstrate something more useful.</p>
<p>Useful, but still just as simple as the previous examples, that is.  Again &#8211; you&#8217;ll need your references from the downloaded IronRuby bin/ folder.  And as you&#8217;ve come to expect, a very simple ruby script defining a lambda function.</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="ruby" style="font-family:monospace;"><span class="re0">$m</span> = <span class="kw3">lambda</span> <span class="br0">&#123;</span>
            a = <span class="kw3">Array</span>.<span class="me1">new</span>
            a.<span class="me1">push</span><span class="br0">&#40;</span>2, 3<span class="br0">&#41;</span>
            <span class="br0">&#40;</span>4..50<span class="br0">&#41;</span>.<span class="me1">each</span> <span class="kw1">do</span>
               <span class="sy0">|</span>i<span class="sy0">|</span>
               <span class="br0">&#40;</span>2..<span class="br0">&#40;</span><span class="kw4">Math</span>.<span class="me1">sqrt</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>.<span class="me1">ceil</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">each</span> <span class="kw1">do</span>
                  <span class="sy0">|</span>thing<span class="sy0">|</span>
                  <span class="kw1">if</span> <span class="br0">&#40;</span>i.<span class="me1">divmod</span><span class="br0">&#40;</span>thing<span class="br0">&#41;</span><span class="br0">&#91;</span>1<span class="br0">&#93;</span> == 0<span class="br0">&#41;</span>
                     a.<span class="me1">push</span> i
                     <span class="kw1">break</span>
                  <span class="kw1">end</span>
               <span class="kw1">end</span>
            <span class="kw1">end</span>
            <span class="kw2">return</span> a
         <span class="br0">&#125;</span></pre></div></div>
<p>From this, we&#8217;ll get an array of the prime numbers.  The function can then be executed rather nicely from within your .NET code like this:</p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><span class="kw1">var</span> ruby <span class="sy0">=</span> Ruby.<span class="me1">GetEngine</span><span class="br0">&#40;</span>Ruby.<span class="me1">CreateRuntime</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;
ruby.<span class="me1">Execute</span><span class="br0">&#40;</span>@<span class="st0">&quot;
    $m = lambda {
//.. snip..
            return a
         }
&quot;</span><span class="br0">&#41;</span>;
<span class="kw1">var</span> rubyContext <span class="sy0">=</span> Ruby.<span class="me1">GetExecutionContext</span><span class="br0">&#40;</span>ruby<span class="br0">&#41;</span>;
<span class="kw1">var</span> m <span class="sy0">=</span> <span class="br0">&#40;</span>Proc<span class="br0">&#41;</span>rubyContext.<span class="me1">GetGlobalVariable</span><span class="br0">&#40;</span><span class="st0">&quot;m&quot;</span><span class="br0">&#41;</span>;
<span class="kw1">var</span> rubyArray <span class="sy0">=</span> <span class="br0">&#40;</span>RubyArray<span class="br0">&#41;</span> m.<span class="me1">Call</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
foreach <span class="br0">&#40;</span><span class="kw1">var</span> o <span class="kw1">in</span> rubyArray<span class="br0">&#41;</span>
<span class="coMULTI">{
    Console.Write(string.Format(&quot;{0}</span><span class="sy0">,</span><span class="st0">&quot;, o));
}</span></pre></div></div>
<p>Now we&#8217;re really starting to leverage that syntactical beauty of ruby within .NET and jumping (almost) seamlessly between the two.  Now, I really should do some demos on something more useful than prime numbers, and perhaps get into one of the big areas of interest of Ruby &#8211; testing frameworks.  Not tonight though <img src='http://www.kevinblake.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Demo project available as usual:</p>
<ul>
<li><a href="http://www.kevinblake.co.uk/wp-content/uploads/2009/07/csharp-execute-ironruby-methods.zip">Download C# IronRuby Method Wrapper</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/running-ruby-methods-within-c-net/631/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Executing complete (Iron)Ruby scripts from within native C# / .NET</title>
		<link>http://www.kevinblake.co.uk/executing-complete-ironruby-scripts-from-within-native-c-net/624/</link>
		<comments>http://www.kevinblake.co.uk/executing-complete-ironruby-scripts-from-within-native-c-net/624/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 20:26:15 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[ironruby]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=624</guid>
		<description><![CDATA[Running Ruby code as-is within .NET is almost too simple to even write home about. In fact I almost didn&#8217;t, but after I wrote it the solution stared up at me with its big brown eyes, and I couldn&#8217;t resist. I&#8217;m not totally sure when I&#8217;d ever need to use this, but perhaps taking some [...]]]></description>
			<content:encoded><![CDATA[<p>Running Ruby code as-is within .NET is almost too simple to even write home about.  In fact I almost didn&#8217;t, but after I wrote it the solution stared up at me with its big brown eyes, and I couldn&#8217;t resist.  I&#8217;m not totally sure when I&#8217;d ever need to use this, but perhaps taking some legacy Ruby scripts where I don&#8217;t really care about the results, and still want to run them amongst some other .NET tasks.  It might come up in some obscure unit testing one day.  You never know.</p>
<p>So, this still serves as an example of how simple it can be to run ruby scripts within .NET.  We&#8217;ll get to making use of some return values, and running individual methods in the next post.</p>
<p>Following on from the last example, the following ruby script prints all the prime numbers between 1 and 50.</p>
<div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_12"></a><a id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12"  onClick="javascript:wpsh_toggleBlock(12)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_12" onClick="javascript:wpsh_code(12)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_12" onClick="javascript:wpsh_print(12)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display: block;"><pre class="ruby" style="font-family:monospace;">state = <span class="kw4">Numeric</span>.<span class="me1">new</span>
<span class="kw3">print</span> <span class="st0">&quot;2,3,&quot;</span>
<span class="br0">&#40;</span>4..50<span class="br0">&#41;</span>.<span class="me1">each</span> <span class="kw1">do</span>
   <span class="sy0">|</span>i<span class="sy0">|</span>
   <span class="br0">&#40;</span>2..<span class="br0">&#40;</span><span class="kw4">Math</span>.<span class="me1">sqrt</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>.<span class="me1">ceil</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">each</span> <span class="kw1">do</span>
      <span class="sy0">|</span>thing<span class="sy0">|</span>
      state = 1
      <span class="kw1">if</span> <span class="br0">&#40;</span>i.<span class="me1">divmod</span><span class="br0">&#40;</span>thing<span class="br0">&#41;</span><span class="br0">&#91;</span>1<span class="br0">&#93;</span> == 0<span class="br0">&#41;</span>
         state = 0
         <span class="kw1">break</span>
      <span class="kw1">end</span>
   <span class="kw1">end</span>
   <span class="kw3">print</span> <span class="st0">&quot;#{i}<span class="es0">\,</span>&quot;</span> <span class="kw1">unless</span> <span class="br0">&#40;</span>state == 0<span class="br0">&#41;</span>
<span class="kw1">end</span></pre></div></div>
<p>With the ruby script complete (you can also run this with the ir.exe that ships with IronRuby if you like)&#8230; Next start up a new project within Visual Studio, and add some references from your downloaded IronRuby bin folder (IronRuby.dll, IronRuby.Libraries.dll etc&#8230;).</p>
<p>You only need a few lines of code to execute your ruby script.</p>
<div id="wpshdo_13" class="wp-synhighlighter-outer"><div id="wpshdt_13" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_13"></a><a id="wpshat_13" class="wp-synhighlighter-title" href="#codesyntax_13"  onClick="javascript:wpsh_toggleBlock(13)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_13" onClick="javascript:wpsh_code(13)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_13" onClick="javascript:wpsh_print(13)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_13" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><span class="kw1">using</span> <span class="co3">IronRuby</span><span class="sy0">;</span>
<span class="co1">// ..</span>
var runtime <span class="sy0">=</span> Ruby.<span class="me1">CreateRuntime</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
runtime.<span class="me1">ExecuteFile</span><span class="br0">&#40;</span><span class="st_h">@&quot;ruby/run.rb&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>As before, you can download the full example to check it and run for yourself.  And also as before, you will also need <a href="http://www.ironruby.net/Download" target="_blank">IronRuby.<br />
</a></p>
<ul>
<li><a href='http://www.kevinblake.co.uk/wp-content/uploads/2009/07/ruby-execute-full-script-within-csharp-demo.zip'>Download C# IronRuby Wrapper</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/executing-complete-ironruby-scripts-from-within-native-c-net/624/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using C# / .NET libraries within IronRuby</title>
		<link>http://www.kevinblake.co.uk/using-c-net-libraries-within-ironruby/602/</link>
		<comments>http://www.kevinblake.co.uk/using-c-net-libraries-within-ironruby/602/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 09:34:10 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[ironruby]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[vistasquad]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=602</guid>
		<description><![CDATA[I attended my first VistaSquad meeting on Wednesday. Part of the evening was a very interesting talk from @ben_hall on IronRuby, which among many other things included how to use any .NET CLR libraries direct from your IronRuby script (running via the .NET DLR). Whilst my example below is extremely trivial, it shows how you [...]]]></description>
			<content:encoded><![CDATA[<p>I attended my first <a href="http://vistasquad.co.uk/" target="_blank">VistaSquad</a> meeting on Wednesday.  Part of the evening was a very interesting talk from <a href="http://www.twitter.com/ben_hall">@ben_hall</a> on IronRuby, which among many other things included how to use any .NET CLR libraries direct from your IronRuby script (running via the .NET DLR).</p>
<p>Whilst my example below is extremely trivial, it shows how you might make use of any existing libraries within your Ruby scripts.  This same technique applies to any .NET libraries, whether they&#8217;re custom, part of the framework, or created by your gran.  I don&#8217;t think I really need to sell it in &#8211; but I love the flexibility that this provides.</p>
<p>So to get to the example, this simple piece of C# displays all the prime numbers between 0 and maxNumber:</p>
<div id="wpshdo_14" class="wp-synhighlighter-outer"><div id="wpshdt_14" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_14"></a><a id="wpshat_14" class="wp-synhighlighter-title" href="#codesyntax_14"  onClick="javascript:wpsh_toggleBlock(14)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_14" onClick="javascript:wpsh_code(14)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_14" onClick="javascript:wpsh_print(14)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_14" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><span class="kw1">public</span> <span class="kw4">int</span><span class="br0">&#91;</span><span class="br0">&#93;</span> DisplayPrimeNumbers<span class="br0">&#40;</span><span class="kw4">int</span> maxNumber<span class="br0">&#41;</span>
<span class="br0">&#123;</span>
    <span class="kw4">int</span> max <span class="sy0">=</span> maxNumber<span class="sy0">;</span>
    List previousPrimes <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> List<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    previousPrimes.<span class="me1">Add</span><span class="br0">&#40;</span>2<span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="kw1">if</span> <span class="br0">&#40;</span>max <span class="sy0">&lt;</span> 2<span class="br0">&#41;</span> <span class="kw1">return</span> null<span class="sy0">;</span> <span class="co1">// none</span>
    <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> <span class="nu0">3</span><span class="sy0">;</span> i  maxDivisor<span class="br0">&#41;</span> break<span class="sy0">;</span>
            <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>i <span class="sy0">%</span> previousPrimes<span class="br0">&#91;</span>j<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">==</span> 0<span class="br0">&#41;</span>
            <span class="br0">&#123;</span>
                foundDivisor <span class="sy0">=</span> true<span class="sy0">;</span>
            <span class="br0">&#125;</span>
        <span class="br0">&#125;</span>
        <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>foundDivisor<span class="br0">&#41;</span>
        <span class="br0">&#123;</span>
            previousPrimes.<span class="me1">Add</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="br0">&#125;</span>
    <span class="br0">&#125;</span>
    <span class="kw1">return</span> previousPrimes.<span class="me1">ToArray</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>We can build that up into a class library and using IronRuby, manipulate the return of the method the same as though we had been running native ruby.</p>
<div id="wpshdo_15" class="wp-synhighlighter-outer"><div id="wpshdt_15" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_15"></a><a id="wpshat_15" class="wp-synhighlighter-title" href="#codesyntax_15"  onClick="javascript:wpsh_toggleBlock(15)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_15" onClick="javascript:wpsh_code(15)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_15" onClick="javascript:wpsh_print(15)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_15" class="wp-synhighlighter-inner" style="display: block;"><pre class="ruby" style="font-family:monospace;"><span class="kw3">require</span> <span class="st0">'mscorlib'</span>
<span class="kw3">require</span> <span class="st0">'CSharpLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'</span>;
prime_numbers = <span class="re2">CSharpLib::PrimeNumbers</span>.<span class="me1">new</span>
<span class="br0">&#40;</span>prime_numbers.<span class="me1">DisplayPrimeNumbers</span> 20<span class="br0">&#41;</span>.<span class="me1">each</span> <span class="kw1">do</span> <span class="sy0">|</span>num<span class="sy0">|</span>
	<span class="kw3">puts</span> num
<span class="kw1">end</span></pre></div></div>
<p>You can download the full sample below, a C# console app is also included for completeness (although isn&#8217;t a part of the IronRuby process).  You will of course, need to <a href="http://www.ironruby.net/Download">download IronRuby</a> first, and add the installed bin/ folder to your path.  Then just change to the <em>&lt;sample&gt;</em>/ruby/ directory, and run it with:</p>
<p><code>ir run.rb</code></p>
<ul>
<li><a href='http://www.kevinblake.co.uk/wp-content/uploads/2009/07/primenumber-ruby-csharp.zip'>Download IronRuby / C# prime number sample</a></li>
</ul>
<p>It&#8217;s probably worth noting that IronRuby is still a way off from a 1.0 release, but it&#8217;s already very usable and looking rather cool.  Since it&#8217;s on <a href="http://www.kevinblake.co.uk/todo/594/">my recent //TODO list</a>, I&#8217;ll be doing a few more examples here &#8211; next time turning this one its head and executing your ruby scripts from within C#.  In the meantime, you can check out <a href="http://www.slideshare.net/BenHalluk/ironruby" target="_blank">Ben&#8217;s set of slides</a> from Wednesday on Slideshare.</int></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/using-c-net-libraries-within-ironruby/602/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gallery2 remote API C# wrapper</title>
		<link>http://www.kevinblake.co.uk/gallery2-remote-api-c-wrapper/586/</link>
		<comments>http://www.kevinblake.co.uk/gallery2-remote-api-c-wrapper/586/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 17:59:22 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[gallery2]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=586</guid>
		<description><![CDATA[I stumbled across the Gallery.NET Toolkit on Twitter, while I should have been doing something more useful; some great work from @rmaclean (thanks for sharing / codeplexing  it). The API wraps up a lot of the Gallery2 remote services into some easy to use C# functions. Hopefully I&#8217;ll find an excuse to use this one day.]]></description>
			<content:encoded><![CDATA[<p>I stumbled across the <a href="http://gallery2.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29252" target="_blank">Gallery.NET Toolkit</a> on Twitter, while I should have been doing something more useful; some great work from <a href="http://www.twitter.com/rmaclean" target="_blank">@rmaclean</a> (thanks for sharing / codeplexing  it).</p>
<p>The API wraps up a lot of the Gallery2 remote services into some easy to use C# functions.</p>
<div id="wpshdo_16" class="wp-synhighlighter-outer"><div id="wpshdt_16" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_16"></a><a id="wpshat_16" class="wp-synhighlighter-title" href="#codesyntax_16"  onClick="javascript:wpsh_toggleBlock(16)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_16" onClick="javascript:wpsh_code(16)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_16" onClick="javascript:wpsh_print(16)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_16" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;">Actions a <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> SADev.<span class="me1">Gallery2</span>.<span class="me1">Protocol</span>.<span class="me1">Actions</span><span class="br0">&#40;</span><span class="st0">&quot;http://www.blakepics.com&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw4">string</span> authToken <span class="sy0">=</span> a.<span class="me1">Login</span><span class="br0">&#40;</span><span class="st0">&quot;*************&quot;</span>, <span class="st0">&quot;*************&quot;</span><span class="br0">&#41;</span>.<span class="me1">AuthToken</span><span class="sy0">;</span>
a.<span class="me1">FetchAlbums</span><span class="br0">&#40;</span>authToken<span class="br0">&#41;</span>.<span class="me1">Albums</span>.<span class="kw1">ForEach</span><span class="br0">&#40;</span>
    album <span class="sy0">=&gt;</span>
    <span class="br0">&#123;</span>
        Console.<span class="me1">WriteLine</span><span class="br0">&#40;</span>album.<span class="me1">Title</span><span class="br0">&#41;</span><span class="sy0">;</span>
        a.<span class="me1">FetchImages</span><span class="br0">&#40;</span>authToken, album.<span class="me1">Name</span><span class="br0">&#41;</span>.<span class="me1">Images</span>.<span class="kw1">ForEach</span><span class="br0">&#40;</span>image <span class="sy0">=&gt;</span>
            Console.<span class="me1">WriteLine</span><span class="br0">&#40;</span><span class="st0">&quot;<span class="es0">\t</span>&quot;</span> <span class="sy0">+</span> image.<span class="me1">Url</span><span class="br0">&#41;</span>
        <span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="br0">&#125;</span>
    <span class="br0">&#41;</span><span class="sy0">;</span>
Console.<span class="me1">ReadKey</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>Hopefully I&#8217;ll find an excuse to use this one day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/gallery2-remote-api-c-wrapper/586/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

