<?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 Mode</title>
	<atom:link href="http://pontusmunck.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://pontusmunck.com</link>
	<description>I blog whenever I C#</description>
	<lastBuildDate>Sun, 22 Jan 2012 10:38:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='pontusmunck.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/06563868b56efa0cb9a4598ceece02a5?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Code Mode</title>
		<link>http://pontusmunck.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://pontusmunck.com/osd.xml" title="Code Mode" />
	<atom:link rel='hub' href='http://pontusmunck.com/?pushpress=hub'/>
		<item>
		<title>Using Rake in .NET projects</title>
		<link>http://pontusmunck.com/2012/01/01/using-rake-in-net-projects/</link>
		<comments>http://pontusmunck.com/2012/01/01/using-rake-in-net-projects/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 12:56:17 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">https://pontusm.wordpress.com/?p=245</guid>
		<description><![CDATA[Last year I started using Rake for my .NET build scripts and it has been a quite pleasant experience that I wanted to share with you. “Hmmm, isn’t Rake one of those scary Ruby tools from the other side of the fence?” you might ask. Yes, indeed, it is a Ruby tool! Many good things [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=245&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last year I started using <a href="http://en.wikipedia.org/wiki/Rake_(software)">Rake</a> for my .NET build scripts and it has been a quite pleasant experience that I wanted to share with you. “Hmmm, isn’t Rake one of those scary Ruby tools from the other side of the fence?” you might ask. Yes, indeed, it is a Ruby tool! Many good things have come from the Ruby community but sadly many .NET developers seem to be scared of even learning about them. &#8220;Yuck, strange Ruby stuff from the Linux world! I can&#8217;t use my .NET knowledge and that must be a bad thing, doesn’t it?&#8221; Well, that&#8217;s a shame! Rake can be used on Windows! And besides, I think it never hurts to at least dip a toe in the ocean once in a while and experience something different than the usual stuff you work with. When a tool helps you to accomplish things with simple elegancy it couldn’t hurt to try it.</p>
<h2>So what is Rake?</h2>
<p>Rake is a tool for creating build scripts. It is a modern variant of the good old Make tool where you describe different tasks and the dependencies between them. Each task is a series of Ruby statements to be executed when the task runs. The flexible nature of the Ruby language makes the task descriptions very brief and elegant.</p>
<p>Here is an example of a task called “deploy” that copies files:</p>
<p><pre class="brush: ruby;">
task :deploy do
    src_path = File.join(BASE_PATH, &quot;Output/bin/.&quot;)
    dest_path = File.join(BASE_PATH, &quot;Deploy&quot;)
    puts &quot;Deploying files...&quot;
    FileUtils.cp_r src_path, dest_path
end
</pre></p>
<h2>Why use Rake?</h2>
<p>Okay, now we know a little about what Rake is, but you may still ask why do we need build scripts at all? Can’t we do everything with Visual Studio and some pre/post build commands?</p>
<p>Sure, we can do quite well with just Visual Studio for small projects. But in larger and more complex projects we often run into situations that require some form of automation and we don’t want to do them every time we build with VS. We need scripts to do various stuff such as deployment and packaging. Maybe we need to update some files with version info, compile an installation kit, upload it via ftp to a server and so on. I’m sure you can come up with a range of time consuming stuff you do on a regular basis that could be done more quickly and reliably by a script instead. The more you can automate the tedious repetitive tasks the more time you can spend doing things that really matter to the customer.</p>
<p>So why not use a simple bat file to run some commands? Yes, that’s one solution but bat files have some significant problems. One is that the error handling is quite cumbersome, you have to use goto statements for flow control and you cannot easily reuse functionality across different bat files. In my experience, as soon as the complexity of the build script rises it will quickly blow up in your face and become a maintenance nightmare. Another glaring omission is the ability to express dependencies between tasks. That is one pretty important thing for structuring a build script successfully that bat files lack.</p>
<p>But what about MSBuild? Wasn’t it created for this purpose exactly? Yes, I have used MSBuild (and before that NAnt) and it sort of works, but it feels very limited. Both MSBuild and NAnt are XML based and declarative. For me, declarative programming is not very intuitive (XSLT anyone?). I feel that I have to think harder before I get things right, instead of just describing what to do in the order I would do it when performing the task manually. With MSBuild I get these set of predefined tasks that I can use, but if they don’t do exactly what I want I’m out in the cold. To me, it feels much more powerful and flexible to write code to do what I want in a build task, and easier to understand and maintain too. Maybe it’s a matter of taste so ultimately you’ll have to decide for yourself…</p>
<h2>Getting started</h2>
<p>Many people are scared because they think it is difficult to setup Ruby and Rake on Windows. This is not the case. To get started you simply run the Ruby Installer that you can download here:</p>
<p><a href="http://rubyinstaller.org/">http://rubyinstaller.org/</a></p>
<p>After installing Ruby, hit the Windows key and type &#8220;Ruby&#8221;. Then click &#8220;Start Command Prompt with Ruby&#8221; in the list that appears. This will bring up a command window where you can use Ruby commands.</p>
<p>To install stuff in Ruby you use &#8220;gem&#8221;. To install Rake simply type:</p>
<p><pre class="brush: ruby;">
C:\&gt;gem install rake
</pre></p>
<p>Now you are good to go!</p>
<h2>Your first script</h2>
<p>By default Rake will look for a file called &#8220;rakefile.rb&#8221; so create a text file with that name and write your first build task like this:</p>
<p><pre class="brush: ruby;">
task :default do
    puts &quot;Wonderful world!&quot;
end
</pre></p>
<p>Then launch this script like this:</p>
<p><pre class="brush: ruby;">
C:\&gt;rake
Wonderful world!
</pre></p>
<p>Pretty simple, wasn&#8217;t it?</p>
<p>In a future post I will show some more examples of what the build scripts may look like, so stay tuned!</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/245/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=245&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2012/01/01/using-rake-in-net-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 8 is here!</title>
		<link>http://pontusmunck.com/2011/09/13/windows-8-is-here/</link>
		<comments>http://pontusmunck.com/2011/09/13/windows-8-is-here/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 18:56:45 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Win8]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">https://pontusm.wordpress.com/2011/09/13/windows-8-is-here/</guid>
		<description><![CDATA[Feeling pretty excited after watching the keynote announcing Windows 8 today! First and foremost it erases all doubts people have had about Silverlight/XAML going away. It’s not going away but instead it is becoming a primary and native technology for developing Windows apps. Another cool thing is that XAML is no longer restricted to .NET [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=233&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Feeling pretty excited after watching the keynote announcing Windows 8 today!</p>
<p>First and foremost it erases all doubts people have had about Silverlight/XAML going away. It’s not going away but instead it is becoming a primary and native technology for developing Windows apps. Another cool thing is that XAML is no longer restricted to .NET but it can also be used from C++ if you need to squeeze out that extra performance in your app. In addition to this you can also write apps using HTML5 and Javascript to run natively on Windows using the same new WinRT APIs. This is great because all those different technologies are good in different situations. To be able to choose the one you like is excellent. To me, it’s like Christmas!</p>
<p>Not only is this a great platform to build stuff for, but it also feels great that you can use the awesome tools Visual Studio and Blend to do it!</p>
<p>All in all, I just wanted to make a quick post about this because it’s such great news. Windows 8 has a lot of new cool features that I recommend you check out.</p>
<p>The preview version of Windows 8 will be available later tonight from <a href="http://dev.windows.com">http://dev.windows.com</a> so make sure you try it out!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/233/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=233&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2011/09/13/windows-8-is-here/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>
	</item>
		<item>
		<title>Deployer &#8211; first public release</title>
		<link>http://pontusmunck.com/2011/08/10/deployer-first-public-release/</link>
		<comments>http://pontusmunck.com/2011/08/10/deployer-first-public-release/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 20:36:09 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[Deployer]]></category>

		<guid isPermaLink="false">https://pontusm.wordpress.com/2011/08/10/deployer-first-public-release/</guid>
		<description><![CDATA[I’m happy to announce the first public release of Deployer – a deployment tool that we have been using in house for the past six years (and still continue to use today) to successfully handle updates for several large web sites and applications. It is written in C# using traditional WinForms and .NET 2.0 so [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=211&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’m happy to announce the first public release of Deployer – a deployment tool that we have been using in house for the past six years (and still continue to use today) to successfully handle updates for several large web sites and applications. It is written in C# using traditional WinForms and .NET 2.0 so it should run on most Windows systems (including Windows XP).</p>
<p>We are releasing this tool for free (and as open source) and hope you will find it useful too. Even though the tool was primarily developed to fit our needs it is pretty flexible and can be used in various situations. For instance, it does not have to be used to deploy a .NET project but can be used on any set of files where you need a little bit of control over what to copy and what not.</p>
<p>Now go ahead and <a href="https://github.com/downloads/pontusm/Deployer/DeployerSetup.exe">download the tool</a> or <a href="https://github.com/pontusm/Deployer">check out the source</a> if you are more into that.</p>
<h2>First look</h2>
<p>So, still curious for more information? Well, let’s take a quick look at the main GUI of the application:</p>
<p><a href="http://pontusm.files.wordpress.com/2011/08/deployer.png"><img style="display:inline;" title="deployer" alt="deployer" src="http://pontusm.files.wordpress.com/2011/08/deployer_thumb.png?w=530&#038;h=412" width="530" height="412"></a></p>
<p>Deployer is similar to the Windows Explorer and shows the folder structure to the left starting from the root folder of your deployment project. The files in the selected folder are shown in the panel to the right. Files in red have been changed since the last deployment and need to be deployed again. This can be done by selecting them, right clicking and selecting “Add file(s) to queue” and then pushing the Deploy button.</p>
<p>A faster way to deploy files is to simply click the button in the toolbar that states “Queue files modified since last deployment” and then press the “Deploy queue” button next to it. This gives you a pretty quick workflow without having to remember what you have changed. Of course, you need to deploy at least once before you can do this.</p>
<h2>Features</h2>
<p>So what are the key features of the Deployer then? I would say the <strong>flexible deployment rules</strong> and the <strong>plugin system</strong>.</p>
<p>The Deployer determines the deployment method to use based on filters. This means that you can deploy different files using different methods and to different targets using configurable rules. Some files can be sent to one FTP site while others a sent to a completely different server. You can also rename files and folders so that it fits the destination structure.</p>
<p>Out of the box the Deployer has support for deploying files via FTP or to a network file share. However, it is extensible via plugins so you can add your own transfer protocols quite easily if you want. For example, at work we have developed plugins to deploy custom objects via a web service directly into a CMS system.</p>
<p>There is also plugin support for “hooks” which can be used to hook into the deployment procedure to provide special services. We are currently using this to stop and restart a Windows service on a remote server when you need to deploy a new version of it.</p>
<p>Multiple configurations are supported so you can have one for deploying to a test server, one for staging and another for live.</p>
<p>Unfortunately right now some features such as multiple configurations and deployment hooks can not be enabled from the GUI but require some manual tweaking of the project file. Usually this is pretty easy to accomplish since it’s just plain XML and quite easy to understand. Hopefully I’ll be able to implement support for configuring all of this from the GUI in the future.</p>
<h2>History</h2>
<p>Back in 2004 when I started developing Deployer we needed a tool for uploading files via FTP. Using a traditional FTP client was painful, since you had to go through each folder of a site and pick out the files to upload. We also had to deploy some custom objects to a CMS system by hand which was quite cumbersome… Clearly we needed something better. So, I developed a first version of the tool that used file filters to determine which files to deploy and where to deploy them and the ball started spinning. Soon we needed more features and I continued to work on the code and added things such as comparing database changes, deploying to multiple targets, specifying filter rules in subfolders, having several configurations and so on. This little tool grew into something that we found quite useful at our company. I’m hoping that by releasing it to the community it may help you too.</p>
<h2>Download &amp; source</h2>
<p>You can download the setup from Github: <a title="https://github.com/downloads/pontusm/Deployer/DeployerSetup.exe" href="https://github.com/downloads/pontusm/Deployer/DeployerSetup.exe">https://github.com/downloads/pontusm/Deployer/DeployerSetup.exe</a></p>
<p>If you want to peek at the code and maybe even contribute you can find it here: <a href="https://github.com/pontusm/Deployer">https://github.com/pontusm/Deployer</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=211&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2011/08/10/deployer-first-public-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2011/08/deployer_thumb.png" medium="image">
			<media:title type="html">deployer</media:title>
		</media:content>
	</item>
		<item>
		<title>Improving current line highlighting in VS2010</title>
		<link>http://pontusmunck.com/2010/08/17/improving-current-line-highlighting-in-vs2010/</link>
		<comments>http://pontusmunck.com/2010/08/17/improving-current-line-highlighting-in-vs2010/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 15:08:12 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[VisualStudio]]></category>

		<guid isPermaLink="false">https://pontusm.wordpress.com/2010/08/17/improving-current-line-highlighting-in-vs2010/</guid>
		<description><![CDATA[Are you experiencing that VS2010 is suddenly highlighting the current line in the text editor? Do you want to get rid of it? I’ll show you how – or maybe convince you to keep it! &#160; Line highlighting First of all, let me explain what I’m talking about in case you haven’t figured yet. Current [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=161&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Are you experiencing that VS2010 is suddenly highlighting the current line in the text editor? Do you want to get rid of it? I’ll show you how – or maybe convince you to keep it!</p>
<p>&#160;</p>
<h3>Line highlighting</h3>
<p>First of all, let me explain what I’m talking about in case you haven’t figured yet. Current line highlighting is when the entire line that your cursor is on is shown in a different color. In my case it looks like this:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/08/image.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/08/image_thumb.png?w=484&#038;h=182" width="484" height="182" /></a> </p>
<p>This is not part of the default functionality in VS2010 so most users never see this. However, if you happen to install the <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef">Productivity Power Tools</a> it will be enabled by default.</p>
<p>The idea is that highlighting the current line will make it easy to see where your cursor is when you have a large monitor and get lost.</p>
<p>Some users probably love this feature. Personally I don’t like it at all when my cursor “taints” the current row like this when I’m editing. I find it plain annoying!</p>
<p>&#160;</p>
<h3>Turning it off</h3>
<p>The first solution if you don’t like it is obviously to turn it off completely. This is pretty easy to do using the settings which you can find under <em>Tools-&gt;Options</em> and then <em>Productivity Power Tools</em>. Just flick the switch to Off:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/08/image1.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/08/image_thumb1.png?w=484&#038;h=280" width="484" height="280" /></a> </p>
<p>Now if that was all I had to say this wouldn’t be a useful blog post. Let’s see what we can do!</p>
<p>&#160;</p>
<h3>Making it work better</h3>
<p>Instead of turning it off we can make better use of this feature. I actually think it is a very good idea to show where the cursor is. However, once I have found the place and start typing the highlighting is just in the way for me.</p>
<p>I have come up with a better solution that involves changing the color of the line depending on if the edit window is active or not. This is possible through the settings under <em>Environment-&gt;Fonts and Colors</em>. There are two entries for the Current Line color, one for when the line is active and one when it is inactive:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/08/image2.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/08/image_thumb2.png?w=484&#038;h=280" width="484" height="280" /></a> </p>
<p>I have set the active color to White which means that when I’m in the edit window and typing the highlighting is hidden. When I navigate classes in the Solution Explorer or elsewhere it will light up. This will effectively work very nicely because when I’m working with other panels or windows and returning to the edit window I can find where I was pretty quickly.</p>
<p>Give it a try and see if it works for you! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#160;</p>
<h3>Conclusion</h3>
<p>Line highlighting is a pretty controversial feature. Some swear by it and some curse it. I hope my post shows one interesting hybrid way of using it that does not get in the way as much as the default behavior.</p>
<p>The <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef">Productivity Power Tools</a> is a really nice addition to Visual Studio and I highly recommend it. Through the settings you can customize it even more if you don’t like how it works. I suggest you play around with it and see if you can find other useful tips and tricks to share. I’d love to hear about them so feel free to leave a comment on my blog! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=161&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2010/08/17/improving-current-line-highlighting-in-vs2010/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/08/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/08/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/08/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Watching DVB-C cable TV in Media Center using Anysee E30C</title>
		<link>http://pontusmunck.com/2010/07/25/watching-dvb-c-cable-tv-in-media-center-using-anysee-e30c/</link>
		<comments>http://pontusmunck.com/2010/07/25/watching-dvb-c-cable-tv-in-media-center-using-anysee-e30c/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 13:29:54 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[MCE]]></category>
		<category><![CDATA[anysee]]></category>
		<category><![CDATA[dvb-c]]></category>

		<guid isPermaLink="false">https://pontusm.wordpress.com/2010/07/25/watching-dvb-c-cable-tv-in-media-center-using-anysee-e30c/</guid>
		<description><![CDATA[Getting digital cable TV (DVB-C) to work in Windows 7 Media Center (MCE) can be really difficult and there isn’t much information available on what to do. Watching encrypted digital cable TV isn’t even supported by Microsoft so how do we solve this? Well, there are a couple of products that can help and one [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=154&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Getting digital cable TV (DVB-C) to work in Windows 7 Media Center (MCE) can be really difficult and there isn’t much information available on what to do. Watching encrypted digital cable TV isn’t even supported by Microsoft so how do we solve this? Well, there are a couple of products that can help and one of them is the <a href="http://www.anysee.com">Anysee</a> E30C digital cable TV card. It has a pretty cool driver that pretends to be a DVB-T card (which MCE supports) and it properly handles encrypted pay TV channels (provided that you have a valid smart card and subscription of course).</p>
<p>&#160;</p>
<h3>Preparations</h3>
<p>This should probably be obvious, but the first thing you need to do is to install the latest drivers for the Anysee card. The drivers on the CD you got when you bought the card are probably outdated so make sure you get them from the Anysee website.</p>
<p>Remember to <strong>reboot</strong> after installing the drivers! Installation doesn’t require you to restart but I’ve had weird problems when I skipped this…</p>
<p>Now, before even trying to get the card working in MCE you should ensure that TV works in the Anysee Viewer application. (You may need to manually scan for channels if your network provider is not one of the supported ones.)</p>
<p>&#160;</p>
<h3>Watching Canal Digital Sweden</h3>
<p>The Anysee card comes preconfigured with settings for different cable TV networks around Europe. However, Canal Digital Sweden is not one of the supported providers. We need a little bit of investigation and configuration to make this work. (This is something you can do for your provider too if needed.)</p>
<p>First of all we need to figure out the settings that Canal Digital uses in Sweden. I did this by examining the information menus in my set top box which had a screen listing channel information with frequencies and symbol rate:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/img_0221.jpg"><img style="display:inline;border-width:0;" title="IMG_0221" border="0" alt="IMG_0221" src="http://pontusm.files.wordpress.com/2010/07/img_0221_thumb.jpg?w=184&#038;h=244" width="184" height="244" /></a> </p>
<p>This revealed the channel frequencies and that symbol rate 6952 is used. Some searching on the internet also revealed that <a href="http://en.wikipedia.org/wiki/Qam">QAM 64</a> is used (which I think is the most common modulation in Sweden). After we have this information along with the frequencies for the channels we are ready to start configuring.</p>
<p>&#160;</p>
<h3>Configuring Anysee CNO</h3>
<p>The Anysee CNO application is responsible for simulating the DVB-T card that MCE uses for watching TV. By default it resides in the <em>C:\Program Files\anysee\Driver</em> directory (or <em>C:\Program Files (x86)\anysee\Driver</em> if you are running 64-bit Windows).</p>
<p>If you look in the subdirectory <em>Transponders\Cable</em> you will find a bunch of preconfigured files for different networks. Unfortunately there is no settings file suitable for Canal Digital Sweden here with QAM 64 and symbol rate 6952. What I did was that I just copied a similar one and renamed it to EU_64QAM_6952.TPL as shown below:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/image.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/07/image_thumb.png?w=244&#038;h=96" width="244" height="96" /></a> </p>
<p>Then I edited the file to make sure the symbol rate said 6952 and verified that the frequencies matched the ones listed by my set top box. In my case everything looked alright so all I had to do was to change one line in the .TPL file:</p>
<div id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">Symbolrate: 6952</pre>
<p><!--CRLF--></div>
</div>
<p>After adding a new settings file we also need to tell the CNO application about it. This is done by editing the CNO.CNO file found in the application directory <em>C:\Program Files\anysee\Driver:</em></p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/image1.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/07/image_thumb1.png?w=244&#038;h=146" width="244" height="146" /></a> </p>
<p>In the CNO.CNO file at about line 143 or so you should find a [Cable-List] section. Just add your new file here similar to what I did:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/image2.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/07/image_thumb2.png?w=244&#038;h=112" width="244" height="112" /></a></p>
<p>It should look something like this when you are done:</p>
<div id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">[Cable-List]</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#008000;">// ±¹°¡ÄÚµå, Áö¿ª, ¼­¹ö½ºÁ¦°øÀÚ, ¸ñ·ÏÆÄÀÏ</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">-1, , Europe_64QAM_6875, .\Transponders\Cable\EU_64QAM_6875.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">-1, , Europe_64QAM_6900, .\Transponders\Cable\EU_64QAM_6900.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">-1, , Europe_64QAM_6952, .\Transponders\Cable\EU_64QAM_6952.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">-1, , Europe_128QAM_6000, .\Transponders\Cable\EU_128QAM_6000.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">-1, , Europe_128QAM_6875, .\Transponders\Cable\EU_128QAM_6875.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">-1, , Europe_128QAM_6900, .\Transponders\Cable\EU_128QAM_6900.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">-1, , Europe_256QAM_6875, .\Transponders\Cable\EU_256QAM_6875.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">-1, , Europe_256QAM_6900, .\Transponders\Cable\EU_256QAM_6900.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">358, , Iisalmen_Puhelin_Oy(IPY), .\Transponders\Cable\Finland_IPY.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">358, , TSF, .\Transponders\Cable\Finland_TSF.TPL</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">358, , Entire, .\Transponders\Cable\Finland_Cable.TPL</pre>
<p><!--CRLF--></div>
</div>
<p>Now you need to restart CNO and change the settings. You can exit CNO by right clicking its icon in the tray bar and selecting <em>Exit</em>.</p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/image3.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/07/image_thumb3.png?w=212&#038;h=93" width="212" height="93" /></a> </p>
<p>After shutting down CNO just relaunch it from the program files directory (<em>C:\Program Files\anysee\Driver\CNO.exe)</em>. Then locate the tray icon again and select <em>Settings</em> from the context menu. This will bring up the settings dialog where you can now find your new settings file that is suitable for the Canal Digital Sweden digital cable TV network:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/image4.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/07/image_thumb4.png?w=209&#038;h=244" width="209" height="244" /></a> </p>
<h3>Configuring Media Center</h3>
<p>Next thing to do is to actually get it working in MCE so start it up and go to the Settings-&gt;TV-&gt;TV Signal to setup the new card:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/image5.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/07/image_thumb5.png?w=244&#038;h=147" width="244" height="147" /></a> </p>
<p>In the next screen select Setup TV Signal and then select your region and enter your postal code. I’ve experimented a bit with these settings but as far as I know it doesn’t matter if you enter 00000 for postal code or the correct one. I suspect it may have something to do with the guide listings but I’m not sure. Things seems to work no matter what I choose here but try entering correct data to make sure you don’t screw up things.</p>
<p>After agreeing to the license you get to choose the type of signal to receive and this is important. You need to select “Antenna” here because that is what MCE supports best and it is also what Anysee CNO simulates:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/image6.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/07/image_thumb6.png?w=244&#038;h=147" width="244" height="147" /></a> </p>
<p>Then select “No” for set-top box and in the following screen choose Digital Antenna (DVB-T) signal:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/07/image7.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/07/image_thumb7.png?w=244&#038;h=147" width="244" height="147" /></a> </p>
<p>When it asks if you want to set up any other TV-signals select “No” and then proceed to scan the channels. This should take a while but when it is ready you should be able to watch Live TV in MCE using your Anysee card!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=154&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2010/07/25/watching-dvb-c-cable-tv-in-media-center-using-anysee-e30c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/img_0221_thumb.jpg" medium="image">
			<media:title type="html">IMG_0221</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/07/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Running Silverlight unit tests in TeamCity using StatLight</title>
		<link>http://pontusmunck.com/2010/05/13/running-silverlight-unit-tests-in-teamcity-using-statlight/</link>
		<comments>http://pontusmunck.com/2010/05/13/running-silverlight-unit-tests-in-teamcity-using-statlight/#comments</comments>
		<pubDate>Thu, 13 May 2010 10:02:59 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[TeamCity]]></category>
		<category><![CDATA[teamcity]]></category>

		<guid isPermaLink="false">https://pontusm.wordpress.com/2010/05/13/running-silverlight-unit-tests-in-teamcity-using-statlight/</guid>
		<description><![CDATA[JetBrains TeamCity is a wonderful product that we use for build management and continuous integration in our .NET and Java projects. The latest version adds support for .NET 4 among other things. However, it does not come with support for running Silverlight unit tests out of the box. In this post I will describe what [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=134&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jetbrains.com/teamcity/">JetBrains TeamCity</a> is a wonderful product that we use for build management and continuous integration in our .NET and Java projects. The latest version adds support for .NET 4 among other things. However, it does not come with support for running Silverlight unit tests out of the box. In this post I will describe what I did to set this up in TeamCity 5.1.</p>
<p>&#160;</p>
<h3>Building the Silverlight project</h3>
<p>First of all I am assuming that you have setup a configuration in TeamCity that is able to build your Silverlight project successfully on the server.</p>
<p><em>I had some problems with building our Silverlight project at first because we are using WCF RIA Services and there does not seem to be any way to install the SDK without having VS2010 installed. Well, actually there is one way but it doesn’t install the Silverlight client libraries that you need to build but only the things you need to run RIA projects on the server. I finally gave in and installed VS2010 on the server although I didn’t like it. However, that solved the build issues for me.</em></p>
<p><em></em></p>
<h3>Setting up StatLight configuration</h3>
<p>Next we take advantage of a lovely little tool called <a href="http://statlight.codeplex.com/">StatLight</a>. It is used to run Silverlight tests more efficiently when you are practicing <a href="http://en.wikipedia.org/wiki/Test-driven_development">TDD</a>. It runs the tests without showing the browser window that the regular <a href="http://code.msdn.microsoft.com/silverlightut/">SLUT</a> framework uses and it has a really nice “continuous” mode that can monitor your project and re-run tests automatically whenever you rebuild your solution. Last but not least, it has support for producing TeamCity compatible reports of the test run!</p>
<p>To use StatLight with TeamCity we need to create a new build configuration to run a command line build. I set it up like this:</p>
<p><strong>General Settings</strong></p>
<p>You can set the general settings as you like but I used the defaults for most of it.</p>
<p><a href="http://pontusm.files.wordpress.com/2010/05/image.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/05/image_thumb.png?w=484&#038;h=376" width="484" height="376" /></a> </p>
<p><strong>Version Control Settings</strong></p>
<p>Under the VCS settings I made sure to set the same checkout directory as I have in my main build configuration. The idea here is to reuse the output from that project when we run this one.</p>
<p><a href="http://pontusm.files.wordpress.com/2010/05/image1.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/05/image_thumb1.png?w=484&#038;h=226" width="484" height="226" /></a> </p>
<p><strong>Build Runner</strong></p>
<p>Next is the Build Runner settings. Here I have specified that I want to run a command line tool and the path to it is:</p>
<p><em>BuildTools\StatLight\statlight.exe</em></p>
<p>This will run StatLight from within the checked out sources where I have put my tools used for building.</p>
<p>If you want you can of course put StatLight in some other path on your server, but I like to include the tools needed to build in the version control system so the right versions of the tools for a project are always present. This way I can upgrade tools in one project and simply commit them in version control and have the build server pick it up automatically.</p>
<p>Next I also needed to configure the parameters to give StatLight:</p>
<p><em>-x=&quot;Source\Tests.Gws3.Client\bin\Release\Tests.Gws3.Client.xap&quot; -v=April2010 –teamcity</em></p>
<p>This tells StatLight where to find the XAP-file with the tests. (This file was actually built using our main build configuration so we need to setup a dependency on that.) We also specify which version of the testing toolkit we want to use and that we want StatLight to output a TeamCity compatible report.</p>
<p><a href="http://pontusm.files.wordpress.com/2010/05/image2.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/05/image_thumb2.png?w=484&#038;h=189" width="484" height="189" /></a> </p>
<p><strong>Build Triggering</strong></p>
<p>Next up is Build Triggering settings. When do we want to run our tests? Well, I think it is a good time to run them whenever our main build has been built successfully so I setup a build dependency trigger for that.</p>
<p><a href="http://pontusm.files.wordpress.com/2010/05/image3.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/05/image_thumb3.png?w=484&#038;h=93" width="484" height="93" /></a> </p>
<p><strong>Dependencies</strong></p>
<p>So are we done yet? No, not quite…We also need to specify that our build configuration is dependent on stuff from another build project. This means that if that project is out of date it will be rebuilt before we run ours.</p>
<p><a href="http://pontusm.files.wordpress.com/2010/05/image4.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/05/image_thumb4.png?w=484&#038;h=128" width="484" height="128" /></a> </p>
<p>&#160;</p>
<h3>Conclusion </h3>
<p>It seemed like a lot of steps to get it all up and running but it really isn’t that much work and once it is setup you can enjoy full continuous integration bliss for your Silverlight projects as well!</p>
<p>If you haven’t tried out TeamCity yet I suggest you check it out! It is <strong>free</strong> for up to 20 build configurations which should be more than enough to get you started.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=134&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2010/05/13/running-silverlight-unit-tests-in-teamcity-using-statlight/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/05/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/05/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/05/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/05/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/05/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Altering database tables with VS2010</title>
		<link>http://pontusmunck.com/2010/04/21/altering-database-tables-with-vs2010/</link>
		<comments>http://pontusmunck.com/2010/04/21/altering-database-tables-with-vs2010/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:21:23 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[VisualStudio]]></category>

		<guid isPermaLink="false">http://pontusm.wordpress.com/2010/04/21/altering-database-tables-with-vs2010/</guid>
		<description><![CDATA[One thing I find quite annoying in Visual Studio is when I try to modify an existing database table and get the following error dialog that prevents me from saving: “You cannot save changes that would result in one or more tables being re-created” So, what the heck is up with that? This seems to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=123&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One thing I find quite annoying in Visual Studio is when I try to modify an existing database table and get the following error dialog that prevents me from saving:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/04/image3.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/04/image_thumb3.png?w=484&#038;h=452" width="484" height="452" /></a> </p>
<p><em>“You cannot save changes that would result in one or more tables being re-created”</em></p>
<p>So, what the heck is up with that? This seems to appear when you move columns around or change the “Allow Nulls” setting. I know I could do this in earlier version of Visual Studio so why can’t I do it anymore? Yes, I know I’m changing the table structure fundamentally but I know what I’m doing and it should be safe to do it – just let me save please!</p>
<p>Well, the wall of text in the dialog actually tells you what to do. You have to enable this in the VS options. For some reason this is disabled by default and my guess is that it is to prevent people who have no clue what they are doing from destroying the database schema…</p>
<p>Anyway here is where you find the option that you should disable. It is called <em>“Prevent saving changes that require table re-creation”</em>:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/04/image4.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/04/image_thumb4.png?w=484&#038;h=287" width="484" height="287" /></a> </p>
<p>Does this mean that you entire table data will be erased when you make a change? No, certainly not! All it means is that your data will be copied to a temporary table and then copied back when the table has been altered. I guess this is how it has always worked but before you never had to bother about it – it just worked.</p>
<p>Well, thanks to this little option it now works again!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=123&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2010/04/21/altering-database-tables-with-vs2010/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/04/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/04/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Adjust namespaces with Resharper 5</title>
		<link>http://pontusmunck.com/2010/04/19/adjust-namespaces-with-resharper-5/</link>
		<comments>http://pontusmunck.com/2010/04/19/adjust-namespaces-with-resharper-5/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 14:29:25 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[Resharper]]></category>
		<category><![CDATA[resharper]]></category>
		<category><![CDATA[VisualStudio]]></category>

		<guid isPermaLink="false">http://pontusm.wordpress.com/2010/04/19/adjust-namespaces-with-resharper-5/</guid>
		<description><![CDATA[A really nice feature in Resharper 5 is the ability to adjust namespaces for code files in a directory. When you move files around in your project or between different projects the namespace no longer matches the directory structure. Updating the namespaces in the code files by hand is quite tedious and error prone. This [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=113&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A really nice feature in Resharper 5 is the ability to adjust namespaces for code files in a directory. When you move files around in your project or between different projects the namespace no longer matches the directory structure. Updating the namespaces in the code files by hand is quite tedious and error prone. This is especially true when you move user controls or web pages that consists of a XAML file or ASP.NET page with a code behind class that needs to match.</p>
<p>You can adjust the namespace for all files in a directory by simply right clicking the folder in Visual Studio and select “Refactor-&gt;Adjust Namespaces…”:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/04/image2.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/04/image_thumb2.png?w=244&#038;h=200" width="244" height="200" /></a> </p>
<p>This will give you the following dialog where you can see the changes that Resharper suggests:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/04/image1.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://pontusm.files.wordpress.com/2010/04/image_thumb1.png?w=445&#038;h=265" width="445" height="265" /></a></p>
<p>Quite handy I think!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=113&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2010/04/19/adjust-namespaces-with-resharper-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/04/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/04/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Using MEF as an IoC container</title>
		<link>http://pontusmunck.com/2010/04/07/using-mef-as-an-ioc-container/</link>
		<comments>http://pontusmunck.com/2010/04/07/using-mef-as-an-ioc-container/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 15:42:00 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[MEF]]></category>
		<category><![CDATA[IoC]]></category>

		<guid isPermaLink="false">http://pontusm.wordpress.com/?p=101</guid>
		<description><![CDATA[The Managed Extensibility Framework is a new wonderful addition to .NET 4 and Silverlight 4. The main purpose of MEF is to handle the extensibility and plug-in capability of an application. It features a very simple and elegant method for creating objects and resolving dependencies by decorating your code with import and export attributes. Managing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=101&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://mef.codeplex.com/Wikipage">Managed Extensibility Framework</a> is a new wonderful addition to .NET 4 and Silverlight 4. The main purpose of MEF is to handle the extensibility and plug-in capability of an application. It features a very simple and elegant method for creating objects and resolving dependencies by decorating your code with import and export attributes.</p>
<p>Managing and resolving dependencies and creating objects is pretty much what a simple IoC (<a href="http://en.wikipedia.org/wiki/Inversion_of_Control">Inversion of Control</a>) container does. So, can we use MEF for this?</p>
<p>The MEF man <a href="http://blogs.msdn.com/gblock/">Glenn Block</a> once said that <em>”you should use MEF to manage your unknown dependencies and an IoC container to manage your known dependencies.”</em> However, I have found that MEF can work pretty well as your one stop solution for all dependencies. It is especially nice if you are building a Silverlight application that already uses MEF (for example to download XAPs dynamically). Why include a separate third party IoC container when there is one built in already?</p>
<p>Here is a short guide for those who want to use MEF for dependency injection in Silverlight.</p>
<h3>MEF libraries</h3>
<p>First of all, you need to add a reference to the MEF libraries. They are included with Silverlight 4:</p>
<p><a href="http://pontusm.files.wordpress.com/2010/04/image.png"><img style="display:inline;border-width:0;" title="image" src="http://pontusm.files.wordpress.com/2010/04/image_thumb.png?w=484&#038;h=234" alt="image" width="484" height="234" border="0" /></a></p>
<p><strong>System.ComponentModel.Composition</strong> – You need this reference anywhere you use the basics of MEF such as importing and exporting.</p>
<p><strong>System.ComponentModel.Composition.Initialization</strong> – You need this reference where you actually initialize and configure the container.</p>
<h3>ServiceLocator class</h3>
<p>To use MEF for resolving dependencies I have built a simple class to set things up and provide a way to create or retrieve instances. This is the code for a simple version of this class:</p>
<pre style="background-color:#fbfbfb;width:100%;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">class</span> ServiceLocator</pre>
<pre style="background-color:#fbfbfb;width:100%;">    {</pre>
<pre style="background-color:#fbfbfb;width:100%;">        <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> CompositionContainer _container;</pre>
<pre style="background-color:#fbfbfb;width:100%;">        <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> AggregateCatalog _catalog;</pre>
<pre style="background-color:#fbfbfb;width:100%;"></pre>
<pre style="background-color:#fbfbfb;width:100%;">        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> Initialize()</pre>
<pre style="background-color:#fbfbfb;width:100%;">        {</pre>
<pre style="background-color:#fbfbfb;width:100%;">            _catalog = <span style="color:#0000ff;">new</span> AggregateCatalog(<span style="color:#0000ff;">new</span> DeploymentCatalog());</pre>
<pre style="background-color:#fbfbfb;width:100%;">            _container = CompositionHost.Initialize(_catalog);</pre>
<pre style="background-color:#fbfbfb;width:100%;">        }</pre>
<pre style="background-color:#fbfbfb;width:100%;"></pre>
<pre style="background-color:#fbfbfb;width:100%;">        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> T GetInstance&lt;T&gt;()</pre>
<pre style="background-color:#fbfbfb;width:100%;">        {</pre>
<pre style="background-color:#fbfbfb;width:100%;">            <span style="color:#0000ff;">return</span> _container.GetExportedValue&lt;T&gt;();</pre>
<pre style="background-color:#fbfbfb;width:100%;">        }</pre>
<pre style="background-color:#fbfbfb;width:100%;">    }</pre>
<p>The Initialize() method sets up an AggregateCatalog and feeds it with a DeploymentCatalog. The AggregateCatalog can contain many MEF catalogs that are added at runtime. Using an AggregateCatalog is not absolutely necessary in this simple example but it is a preparation for loading dependencies dynamically in the future.</p>
<p>The DeploymentCatalog is used in Silverlight for working with XAP files. It is a very handy class for loading external XAPs if your application is split up in modules. Creating a DeploymentCatalog without any parameters will create a catalog for the main application XAP file and this will allow us to access the exported types in all the assemblies of our main XAP file.</p>
<p>When we call CompositionHost.Initialize() our assemblies will be scanned by MEF and all exports are discovered. We are then ready to call the GetInstance&lt;T&gt;() method whenever we need an instance of an exported class.</p>
<h3>Exporting types</h3>
<p>Traditional IoC containers often involve configuring components using either XML or registering them using code. With MEF you simply put an [Export] attribute on your class to indicate that it should be available for composition:</p>
<pre style="background-color:#ffffff;width:100%;">    [Export]</pre>
<pre style="background-color:#ffffff;width:100%;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> Car</pre>
<pre style="background-color:#ffffff;width:100%;">    {</pre>
<pre style="background-color:#ffffff;width:100%;">        ...</pre>
<pre style="background-color:#ffffff;width:100%;">    }</pre>
<p>This will expose the type Car to MEF and lets you retrieve it in IoC fashion like this:</p>
<pre style="background-color:#ffffff;width:100%;">    var car = ServiceLocator.GetInstance&lt;Car&gt;();</pre>
<p>Often you want to expose a certain interface that your type implements. You can do this by supplying the type in the [Export] attribute like this:</p>
<pre style="background-color:#ffffff;width:100%;">    [Export(<span style="color:#0000ff;">typeof</span>(ICar)]</pre>
<pre style="background-color:#ffffff;width:100%;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> Car : ICar</pre>
<pre style="background-color:#ffffff;width:100%;">    {</pre>
<pre style="background-color:#ffffff;width:100%;">        ...</pre>
<pre style="background-color:#ffffff;width:100%;">    }</pre>
<p>The default behavior in MEF is to treat exports as singletons. That is, if you don’t specify anything to override this behavior you will only get one instance of the Car object in your application no matter how many times you call GetInstance&lt;Car&gt;(). <em>Actually, if the exported type does not specify anything the default is to allow either singleton or non shared so it is up to the caller to decide what he wants.</em></p>
<p>If you want unique instances to be created every time you retrieve an instance of your type you can specify this using an extra attribute on your class:</p>
<pre style="background-color:#ffffff;width:100%;">    [Export]</pre>
<pre style="background-color:#ffff00;width:100%;">    [PartCreationPolicy(CreationPolicy.NonShared)]</pre>
<pre style="background-color:#ffffff;width:100%;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> Car</pre>
<pre style="background-color:#ffffff;width:100%;">    {</pre>
<pre style="background-color:#ffffff;width:100%;">        ...</pre>
<pre style="background-color:#ffffff;width:100%;">    }</pre>
<h3>Dependency injection</h3>
<p>Of course an application is seldom built with only a single class. Most likely you have many parts that fit together and you want to use the IoC container to resolve everything smoothly for you using dependency injection. MEF can do this as well, but you have to decorate the constructor to use with the [ImportingConstructor] attribute:</p>
<pre style="background-color:#fbfbfb;width:100%;">    [Export]</pre>
<pre style="background-color:#fbfbfb;width:100%;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> Car</pre>
<pre style="background-color:#fbfbfb;width:100%;">    {</pre>
<pre style="background-color:#ffff00;width:100%;">        [ImportingConstructor]</pre>
<pre style="background-color:#fbfbfb;width:100%;">        <span style="color:#0000ff;">public</span> Car(Engine engine)</pre>
<pre style="background-color:#fbfbfb;width:100%;">        {</pre>
<pre style="background-color:#fbfbfb;width:100%;">        }</pre>
<pre style="background-color:#fbfbfb;width:100%;">    }</pre>
<pre style="background-color:#fbfbfb;width:100%;"></pre>
<pre style="background-color:#fbfbfb;width:100%;">    [Export]</pre>
<pre style="background-color:#fbfbfb;width:100%;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> Engine</pre>
<pre style="background-color:#fbfbfb;width:100%;">    {</pre>
<pre style="background-color:#fbfbfb;width:100%;"></pre>
<pre style="background-color:#fbfbfb;width:100%;">    }</pre>
<p>When retrieving a Car instance MEF will automatically create and inject the Engine in the constructor of the class just like an ordinary IoC container would.</p>
<p>All in all, those 20 lines of code is all you need to get started with MEF as an IoC container. You can now retrieve instances of your objects with injected dependencies and that’s pretty much what you need in most cases.</p>
<h3>Conclusion</h3>
<p>I wanted to keep this example as simple as possible and have deliberately left out topics like object lifetime, dynamically loading XAPs and so on. I am planning to write about those things in upcoming posts.</p>
<p>I think MEF provides a great alternative to the traditional IoC containers. It is very easy to setup and get started with. I also like the fact that all configuration sticks with the class, which makes it easy for newcomers in your project to pick things up quickly and write new components simply by looking at an existing class.</p>
<p>I believe MEF is going to be central in all .NET 4 development. Don’t miss out!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=101&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2010/04/07/using-mef-as-an-ioc-container/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/04/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>My impressions from MIX10</title>
		<link>http://pontusmunck.com/2010/03/21/my-impressions-from-mix10/</link>
		<comments>http://pontusmunck.com/2010/03/21/my-impressions-from-mix10/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 17:10:48 +0000</pubDate>
		<dc:creator>Pontus</dc:creator>
				<category><![CDATA[MIX]]></category>

		<guid isPermaLink="false">http://pontusm.wordpress.com/2010/03/21/my-impressions-from-mix10/</guid>
		<description><![CDATA[I’m finally back home after a crazy and wonderful week visiting MIX10 in Las Vegas. It was a great conference and I really had a good time watching the sessions and meeting people. I got the chance to talk to Brad Abrams, Nikhil Khotari and Colin Blair about WCF RIA Services, chatted with the devs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=94&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://pontusm.files.wordpress.com/2010/03/image1.png"><img style="display:inline;border:0;margin:0 0 10px 10px;" title="image" src="http://pontusm.files.wordpress.com/2010/03/image_thumb1.png?w=184&#038;h=244" border="0" alt="image" width="184" height="244" align="right" /></a> I’m finally back home after a crazy and wonderful week visiting <a href="http://live.visitmix.com/">MIX10</a> in Las Vegas. It was a great conference and I really had a good time watching the sessions and meeting people. I got the chance to talk to <a href="http://blogs.msdn.com/brada/">Brad Abrams</a>, <a href="http://www.nikhilk.net/">Nikhil Khotari</a> and <a href="http://www.riaservicesblog.net/Blog/">Colin Blair</a> about WCF RIA Services, chatted with the devs working on Bing, talked to <a href="http://10rem.net/">Pete Brown</a> about his cool C64 emulator built in Silverlight, met Roland Weigelt who created the wonderful <a href="http://submain.com/products/ghostdoc.aspx">GhostDoc</a> add-in for Visual Studio and got a tip about <a href="http://jens-schaller.de/sonictools/sonicfilefinder/index.htm">Sonic File Finder</a> from his friend. All in all the atmosphere was great and a lot of the speakers and people from Microsoft were hanging around chatting with people all the time which I think was great.</p>
<p>So what impact did MIX10 had on me personally? Well, after doing some thinking I want to present the five most important things that made an impression on me:</p>
<h3>1 &#8211; Windows Phone 7</h3>
<p><a href="http://pontusm.files.wordpress.com/2010/03/image2.png"><img style="display:inline;margin-left:0;margin-right:0;border:0;" title="image" src="http://pontusm.files.wordpress.com/2010/03/image_thumb2.png?w=240&#038;h=142" border="0" alt="image" width="240" height="142" align="right" /></a></p>
<p>Microsoft is really pushing the new version of their mobile phone OS. Yeah, they have stolen a lot of ideas from Apple but it’s not the first time Microsoft does that. Copying a successful concept is also a way of making business. However, they’ve introduced some really great innovations as well, improved some of the shortcomings of the competitors and I must say that the phone UI feels really slick and modern. I could actually see myself using this instead of my Iphone! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>What made me really interested in the phone is the fact that it seems so simple to get started with developing for it. Since it runs Silverlight it is really easy to get an application up and running if you’re familiar with .NET development. This is radically different from developing for the Iphone or Android for me. It also supports writing applications in XNA which is a great framework for developing more advanced applications like games.</p>
<p>Additionally Microsoft has released the tools <strong>for free</strong> so you can build apps with no up-front investment at all. That’s a pretty nice deal for such great tools as Visual Studio and Blend.</p>
<p><a title="http://developer.windowsphone.com/" href="http://developer.windowsphone.com/">http://developer.windowsphone.com/</a></p>
<h3>2 &#8211; OData</h3>
<p><a href="http://pontusm.files.wordpress.com/2010/03/image3.png"><img style="display:inline;border:0;margin:0;" title="image" src="http://pontusm.files.wordpress.com/2010/03/image_thumb3.png?w=227&#038;h=86" border="0" alt="image" width="227" height="86" align="right" /></a> <a href="http://www.odata.org/">The Open Data Protocol</a> (or OData for short) is a pretty awesome concept that Microsoft presented at MIX10.</p>
<p>Many successful internet businesses today enable their users a rich web API that is used to access their service in many different ways with various clients. The web browser is only one type of client in a larger ecosystem of mobile phones, desktop applications and other devices that wants to work with data over the web. Twitter is an example of this, where they only provide a rudimentary interface on the website and the entire experience is greatly enhanced by a large variety of clients available for different platforms.</p>
<p>OData is a REST based API that aims to be a standard way of accessing services over the web. Microsoft enables you to easily expose an OData interface from your ASP.NET application as well as client libraries for consuming OData from various environments. They obviously provide a .NET and WP7 client libraries, but surprisingly they have developed libraries for accessing OData also from PHP, Java and Iphone. That’s really neat!</p>
<p>Another cool thing is a service that goes by the name <a href="http://pinpoint.microsoft.com/en-US/Dallas">Codename “Dallas”</a>. This is Microsoft’s solution for people to expose and make money off their data. Even if you’re a small one man business you can take advantage of this and make money if you have something interesting to share. One guy I met in the “RIA Services suite” had a lot of historical baseball data that he wanted to share and I think he could make some money with data.</p>
<p>Check out the keynote from day 2 at about 59:00 for a demo of this stuff:</p>
<p><a title="http://live.visitmix.com/MIX10/Sessions/KEY02" href="http://live.visitmix.com/MIX10/Sessions/KEY02">http://live.visitmix.com/MIX10/Sessions/KEY02</a></p>
<h3>3 &#8211; Azure</h3>
<p>I saw some demos of Azure at MIX10 and it is starting to look really smooth. I haven’t really had the time to try it out yet but it is looking more and more compelling. Previously I’ve heard that it’s been quite instable and buggy but it looks like that has been straightened out. Maybe it is finally time to start building stuff for the cloud now! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I really like that you can test your stuff out in the “DevFabric” which is a simulated cloud environment on your dev machine. Then you can for example start by moving up your data storage to the cloud while still running the code on your dev machine and continue testing your solution, and when you’re ready you move it all up into the cloud. It all seemed really simple and all you need to do to get started is to install the Azure SDK which is available from here:</p>
<p><a title="http://dev.windowsazure.com/" href="http://dev.windowsazure.com/">http://dev.windowsazure.com/</a></p>
<h3>4 &#8211; IE9</h3>
<p><a href="http://pontusm.files.wordpress.com/2010/03/image4.png"><img style="display:inline;border:0;margin:0 0 0 10px;" title="image" src="http://pontusm.files.wordpress.com/2010/03/image_thumb4.png?w=100&#038;h=106" border="0" alt="image" width="100" height="106" align="right" /></a> Microsoft is really taking a leap forward with version 9 of Internet Explorer. IE has lost a lot of users the past years and Microsoft is really committed to improving its performance and standards compliance. It was interesting to see a demonstration of cases where the new IE version really shines in a head to head comparison with other browsers, especially Google Chrome (which is one of the fastest browsers at the moment). Competition like this is really good for the browser market. At the same time Microsoft is really trying to help out its competitors by setting up this website with test cases that they can run to check their performance.</p>
<p>Some notable things about IE9 is the GPU accelerated HTML5 and better standards compliance, for example with rounded and dotted CSS borders…Examples can be found at this address: <a title="http://www.ietestdrive.com/" href="http://www.ietestdrive.com/">http://www.ietestdrive.com/</a></p>
<p>Also check out the keynote from day 2 where they start off talking about the new IE9 engine: <a title="http://live.visitmix.com/MIX10/Sessions/KEY02" href="http://live.visitmix.com/MIX10/Sessions/KEY02">http://live.visitmix.com/MIX10/Sessions/KEY02</a></p>
<h3>5 &#8211; MVVM</h3>
<p>The Model-View-ViewModel design pattern has been around for a while but it is now finally gaining more and more attention among Silverlight developers and most importantly in the tools coming from Microsoft. The new version of Blend will have some really useful features for working in a MVVM oriented way like for example being able to generate sample data based on a ViewModel class in your project.</p>
<p>I watched a couple of great sessions about MVVM at MIX. If you want to learn more you can check out the introductory session by Laurent Bugnion:</p>
<p><a title="http://live.visitmix.com/MIX10/Sessions/EX14" href="http://live.visitmix.com/MIX10/Sessions/EX14">http://live.visitmix.com/MIX10/Sessions/EX14</a></p>
<p>I also saw the session by Rob Eisenberg and was deeply impressed by his elegant solutions and ideas:</p>
<p><a title="http://live.visitmix.com/MIX10/Sessions/EX15" href="http://live.visitmix.com/MIX10/Sessions/EX15">http://live.visitmix.com/MIX10/Sessions/EX15</a></p>
<h3>Conclusion</h3>
<p>Okay, so that’s a list of things that I found most important at this conference. Of course, there was a lot more going on so I recommend that you take a look at all the videos that have been released and find the things of interest to you:</p>
<p><a title="http://live.visitmix.com/Videos" href="http://live.visitmix.com/Videos">http://live.visitmix.com/Videos</a></p>
<p>Feel free to comment if you think I’ve missed something significant!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pontusm.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pontusm.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pontusm.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pontusm.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pontusm.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pontusm.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pontusm.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pontusm.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pontusm.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pontusm.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pontusm.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pontusm.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pontusm.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pontusm.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pontusmunck.com&amp;blog=11490189&amp;post=94&amp;subd=pontusm&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pontusmunck.com/2010/03/21/my-impressions-from-mix10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e6162ee4f5c1c3746d7968b83e00a516?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pontus</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/03/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/03/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/03/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://pontusm.files.wordpress.com/2010/03/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
