<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.1-alpha" -->
<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/"
>

<channel>
	<title>rod.pl</title>
	<link>http://rod.blogsome.com</link>
	<description>rod's personal blog. Visitors can find here usefull informations about C#, Football Manager, Gimp and so on</description>
	<pubDate>Wed, 09 Jul 2008 19:43:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.1-alpha</generator>
	<language>en</language>

		<item>
		<title>CodeRush with Refactor! Pro vs ReSharper</title>
		<link>http://rod.blogsome.com/2008/07/09/coderush-with-refactor-pro-vs-resharper/</link>
		<comments>http://rod.blogsome.com/2008/07/09/coderush-with-refactor-pro-vs-resharper/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 19:33:54 +0000</pubDate>
		<dc:creator>rod</dc:creator>
		
	<category>Tools</category>
		<guid>http://rod.blogsome.com/2008/07/09/coderush-with-refactor-pro-vs-resharper/</guid>
		<description><![CDATA[Every developer knows already, that Visual Studio is not sufficient enough for code writing. There are lots of Add-ons which are able to improve daily work to significant manner. I use such tools everyday as : ViEmu, GhostDoc and Smart Paster. I used also CodeRush + Refactor! Pro from 1.5 year, but from moment of [...]]]></description>
			<content:encoded><![CDATA[<p>Every developer knows already, that Visual Studio is not sufficient enough for code writing. There are lots of Add-ons which are able to improve daily work to significant manner. I use such tools everyday as : ViEmu, GhostDoc and Smart Paster. I used also CodeRush + Refactor! Pro from 1.5 year, but from moment of appearance of ReSharper 4.0 public beta versions, I decided to take closer look to this tool.</p>  <p>After several months of using ReSharper, I&#8217;ll try to make a small comparison of both products functions in range I used most often.</p>  <p><em>Some images are linked with external animations.</em></p>  <h3>Refactoring</h3>  <p>Both tool contain similar amount and quality of refactoring functionality.&#160; There is a small inconvenience of mouse using during refactoring in ReSharper. Just keyboard usage is enough for CodeRush using.</p>  <p>Here is simple example of method signature change</p>  <p>R#</p>  <p>&#160;<a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fimages24.fotosik.pl%2F244%2Fc9a2dae7074ed128.gif&amp;i=0&amp;c=12031bb4259abce996670e7bfacb2361a4b61207" target="_blank"><img src="http://images27.fotosik.pl/243/ce6d67bbc27d0ed3.jpg" /></a> </p>  <p>CR</p>  <p><a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fimages30.fotosik.pl%2F244%2F99200de9d1f8776e.gif&amp;i=0&amp;c=0595ca4948d9fcb7abc0cb8100fadc5e8143bd33" target="_blank"><img src="http://images31.fotosik.pl/313/505b21a8801f75a3.jpg" /></a> </p>  <h3>Code generation</h3>  <p>Both tools have sound and weak parts in code generation. Better possibilities of creating more intelligent code templates are in CodeRush than on ReSharper. It&#8217;s all about definition of conditions when and which template can be generated. In CodeRush, you can define that writing &#8216;c&#8217; and then &#8217;space&#8217; pressing will generate &quot;case&quot; keyword in &quot;switch&quot; statement but in &quot;foreach&quot; loop it will generate &quot;continue&quot; keyword. ReSharper is less flexible in defining such conditions. In fact, I can live without it. The bigger problem is that CodeRush cannot allow you to hare these templates among other users. Templates are kept in user local folders and there is only export and import function. ReSharper can share templates in many ways:</p>  <ul>   <li>per system</li>    <li>per user</li>    <li>per solution</li>    <li>per personal solution </li>    <li>defined in external file - it helps to maintain corporate range templates</li> </ul>  <p>ReSharper has one more kind of template, which CodeRush does no have it at all, file template.</p>  <p>We can treat unit tests as a API sketch, as as draft for defining how our class can be used. To do that we just write name of methods and proprieties which actually doesn&#8217;t exist yet. Both tools will generate proper stubs for them.</p>  <p>ReSharper isn&#8217;t sometimes as intuitive as it would be. That&#8217;s why I suggest to take a simple&#160; look to documentation before using it, if you don&#8217;t want to be surprised. Some day I wanted to create some overloads for a method. In CodeRush, you can place cursor on method name, press Ctrl + `, and you will see how easy is to create overloads by using &quot;space&quot; and &quot;left, right arrows&quot;&#8230;</p>  <p><a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fimages32.fotosik.pl%2F313%2Fe56f62b114d081cc.gif&amp;i=0&amp;c=aef692d2001f75c99ba2dc0a0be8a01b2b1d083c" target="_blank"><img src="http://images29.fotosik.pl/243/2dca7de9649d2f72.jpg" /></a></p>  <p>&#8230; in ReSharper you need to select method parameters and then press Alt+Enter &#8230;</p>  <p><a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fimages33.fotosik.pl%2F314%2F7cd3fa9ddc499002.gif&amp;i=0&amp;c=4f151e015eb63c13e653ca55d678a5cd9f626e0f" target="_blank"><img src="http://images25.fotosik.pl/242/2a0a62699a7368da.jpg" /></a> </p>  <p>In that situation you cannot make and overload&#160; for example removing first and third method parameter.</p>  <p>Generating additional code based on existing code is solved in two ways. Example of generating properties based on existing fields.In ReSharper, you need to press Alt + Insert and then choose fields &#8230;</p>  <p><a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fimages26.fotosik.pl%2F244%2Fd48d067a7000ff67.gif&amp;i=0&amp;c=e6209d9f64f0a1362e00dacac20ca99d9093a2eb" target="_blank"><img src="http://images27.fotosik.pl/243/d7d382510e5367cd.jpg" /></a> </p>  <p>CodeRush has SmartPaste i SmartCopy. In that case it is enough to copy field and paste it. That&#8217;s what developers love the most ;) copy &amp; paste :).</p>  <p><a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fimages23.fotosik.pl%2F243%2F2a16588d2400a7b4.gif&amp;i=0&amp;c=2e912b276d6a2b90ec978cb61fbcdc5013fa5a1b" target="_blank"><img src="http://images31.fotosik.pl/313/488c9f52c465880a.jpg" /></a> </p>  <p>This way is not good enough if we have a bunch of fields which are not grouped together and are different types. In that situation SmartPaste doesn&#8217;t work too good, ReSharper&#8217;s way doesn&#8217;t look nicer but work better.</p>  <h3>Additional ReSharper functionalists &#8230;</h3>  <p>&#8230; which there is lack of in CodeRush.</p>  <h4>Code analysis</h4>  <p><img src="http://www.jetbrains.com/resharper/features/screenshots/40/marker_bar.png" /> </p>  <p>ReSharper analyses code all the time and can point out errors even before compiler will do that. Additionally suggest us how to better write a code.</p>  <p><img src="http://www.jetbrains.com/resharper/features/screenshots/40/suggestion_1.png" /> </p>  <p>But it has price. This functionality needs more memory from our machine and can slow down Visual Studio when you are writing code in DSL-like manner. Many methods or properties connected in one logical line like in NBehave testing.</p>  <p><a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fwww.jetbrains.com%2Fresharper%2Ffeatures%2Fcode_analysis.html&amp;i=0&amp;c=e607704f0544d121713b8afda0804836ca0fbb37" target="_blank">More about code analysis</a></p>  <h4>Code reordering and formatting</h4>  <p>Java users had a Jalopy, C# users had nothing until ReShareper came out. In my opinion it is the best tool for automatically C# code formatting in the market. It is fully configurable and configuration can be shared among other developers. This will allow us to make our own corporate standard of code formatting.</p>  <p><a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fwww.jetbrains.com%2Fresharper%2Ffeatures%2Fcode_formatting.html&amp;i=0&amp;c=fb130bd72fd776199a3637374cdd274625c9563e" target="_blank">More about code reordering and formatting</a></p>  <h4>ToDo Explorer</h4>  <p><img src="http://www.jetbrains.com/resharper/features/screenshots/40/navigation_todoexplorer.png" /> </p>  <p>Visual Studio allows us to insert special tags in comment such us TODO, FIX ,HACK and so on. But it cannot make a summary list of them from whole solutions. ReSharper can do that.</p>  <h4>Unit Testing</h4>  <p><img src="http://www.jetbrains.com/resharper/features/previews/testClass.gif" /> </p>  <p>Now we have all in one place. Running, debugging and profiling tests also. ReSharper ca run NUnit test only by default. But there is some plug-ins which integrate TestRunner with other frameworks.</p>  <a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fwww.dotnetkicks.com%2Fkick%2F%3Furl%3Dhttp%253a%252f%252frod.blogsome.com%252f2008%252f07%252f09%252fcoderush-with-refactor-pro-vs-resharper%252f&amp;i=0&amp;c=a9e0336057b043bfb3a190fc51ba0989222325b5"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2frod.blogsome.com%2f2008%2f07%2f09%2fcoderush-with-refactor-pro-vs-resharper%2f&amp;border=000099&amp;fgcolor=0000CC&amp;bgcolor=66CCCC&amp;cfgcolor=000066" border="0" alt="kick it on DotNetKicks.com" /></a>]]></content:encoded>
			<wfw:commentRss>http://rod.blogsome.com/2008/07/09/coderush-with-refactor-pro-vs-resharper/feed/</wfw:commentRss>
	</item>
		<item>
		<title>ReflectionHelper - DSL-like reflection manipulating</title>
		<link>http://rod.blogsome.com/2008/06/22/reflectionhelper-dsl-like-reflection-manipulating/</link>
		<comments>http://rod.blogsome.com/2008/06/22/reflectionhelper-dsl-like-reflection-manipulating/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 16:09:33 +0000</pubDate>
		<dc:creator>rod</dc:creator>
		
	<category>.NET</category>
	<category>C#</category>
	<category>rod.Commons</category>
		<guid>http://rod.blogsome.com/2008/06/22/reflectionhelper-dsl-like-reflection-manipulating/</guid>
		<description><![CDATA[I&#8217;ve added ReflectionHelper and ReflectionHelperExtensions classes in rod.Commons project. These classes are useful for simple object modifying by reflection.  ReflectionHelper is for NET 2.0 and above and can be used like this:             1: public void ChangeTransferAmountToTenDollars(Transfer transfer)

      [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added ReflectionHelper and ReflectionHelperExtensions classes in <a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fcode.google.com%2Fp%2Frodcommons%2F&amp;i=0&amp;c=557b7f30b023e647afe7dbb4c43b38c49e0fb4c8" target="_blank">rod.Commons</a> project. These classes are useful for simple object modifying by reflection.</p>  <p>ReflectionHelper is for NET 2.0 and above and can be used like this:</p>  <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">   <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">     <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> ChangeTransferAmountToTenDollars(Transfer transfer)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">return</span> ReflectionHelper.For(transfer)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>         .Field(<span style="color: #006080">&quot;amount&quot;</span>)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>         .SetValue(10)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         .Property(<span style="color: #006080">&quot;Currency&quot;</span>)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>         .SetValue(<span style="color: #006080">&quot;USD&quot;</span>)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>         .Return&lt;Transfer&gt;();</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span> }</pre>
  </div>
</div>

<p>ReflectionHelperExtensions is for NET 3.5+ and it is just extension adding Reflect() method for easier using ReflectionHelper like this:</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> ChangeTransferAmountToTenDollars(Transfer transfer)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">return</span> transfer.Reflect()</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>         .Field(<span style="color: #006080">&quot;amount&quot;</span>)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>         .SetValue(10)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         .Property(<span style="color: #006080">&quot;Currency&quot;</span>)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>         .SetValue(<span style="color: #006080">&quot;USD&quot;</span>)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>         .Return&lt;Transfer&gt;();</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span> }</pre>
  </div>
</div>

<p><a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fwww.dotnetkicks.com%2Fkick%2F%3Furl%3Dhttp%253a%252f%252frod.blogsome.com%252f2008%252f06%252f22%252freflectionhelper-dsl-like-reflection-manipulating%252f&amp;i=0&amp;c=c201495aa37e6f99ad56f212cb3e2fe55f9b0a26"><img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2frod.blogsome.com%2f2008%2f06%2f22%2freflectionhelper-dsl-like-reflection-manipulating%2f&amp;border=000099&amp;fgcolor=0000CC&amp;bgcolor=66CCCC&amp;cfgcolor=000066" border="0" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://rod.blogsome.com/2008/06/22/reflectionhelper-dsl-like-reflection-manipulating/feed/</wfw:commentRss>
	</item>
		<item>
		<title>rod.Commons - Goes public</title>
		<link>http://rod.blogsome.com/2008/06/22/rodcommons-goes-public/</link>
		<comments>http://rod.blogsome.com/2008/06/22/rodcommons-goes-public/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 11:00:52 +0000</pubDate>
		<dc:creator>rod</dc:creator>
		
	<category>.NET</category>
	<category>C#</category>
	<category>rod.Commons</category>
		<guid>http://rod.blogsome.com/2008/06/22/rodcommons-goes-public/</guid>
		<description><![CDATA[	Every developer has his own utility library where collects very useful classes. I decided to share my pack of tricky tools which are named &quot;rod.Commons&quot;. I&#8217;m currently doing some refactoring and code cleaning to make it more readable so you will find not much code there yet. rod.Commons is available in Google Code - http://code.google.com/p/rodcommons/. [...]]]></description>
			<content:encoded><![CDATA[	<p>Every developer has his own utility library where collects very useful classes. I decided to share my pack of tricky tools which are named &quot;rod.Commons&quot;. I&#8217;m currently doing some refactoring and code cleaning to make it more readable so you will find not much code there yet. rod.Commons is available in Google Code - <a title="http://code.google.com/p/rodcommons/" href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fcode.google.com%2Fp%2Frodcommons%2F&amp;i=0&amp;c=557b7f30b023e647afe7dbb4c43b38c49e0fb4c8">http://code.google.com/p/rodcommons/</a>. I hope that some of you will find it useful and I will be appreciated for any comments and ideas.</p>
]]></content:encoded>
			<wfw:commentRss>http://rod.blogsome.com/2008/06/22/rodcommons-goes-public/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Compiling solution in Visual Studio with generating project version based on SVN revision</title>
		<link>http://rod.blogsome.com/2008/02/21/compiling-solution-in-visual-studio-with-generating-project-version-based-on-svn-revision/</link>
		<comments>http://rod.blogsome.com/2008/02/21/compiling-solution-in-visual-studio-with-generating-project-version-based-on-svn-revision/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 11:10:19 +0000</pubDate>
		<dc:creator>rod</dc:creator>
		
	<category>C#</category>
	<category>Subversion</category>
	<category>MSBuild</category>
		<guid>http://rod.blogsome.com/2008/02/21/compiling-solution-in-visual-studio-with-generating-project-version-based-on-svn-revision/</guid>
		<description><![CDATA[I&#8217;ve used to compile projects with NAnt. I&#8217;m using MSBuild currently. Main reason was to unify&#160; build scripts during projects building inside and outside of Visual Studio. NAnt was helping me to create dynamically AssemblyInfo and than to compile into project. Attributes such as AssemblyTitle or AssemblyCompany were managed from one place and project version [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve used to compile projects with NAnt. I&#8217;m using MSBuild currently. Main reason was to unify&#160; build scripts during projects building inside and outside of Visual Studio. NAnt was helping me to create dynamically AssemblyInfo and than to compile into project. Attributes such as AssemblyTitle or AssemblyCompany were managed from one place and project version was generated with SVN revision based on. AssemblyInfo file wasn&#8217;t included into the project that&#8217;s why Solution Explorer didn&#8217;t even know about its existence. There was no problem with building project and messages about missing AssemblyInfo file despite of absence of this file in SVN repository. Now it is time MSBuild do this same for me :).</p>  <p>Let&#8217;s start with example of file compiling which is absent in Solution Explorer. Just add new AssemblyInfo.cs and then make it &quot;Exclude From Project&quot;. Now we need to add it dynamicaly to the list of compiled files. Let&#8217;s modify our actual project file - .csproj, find target named &quot;BeforeBuild&quot; and put there some lines &#8230;</p>  <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">   <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">     <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Target</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;BeforeBuild&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">CreateItem</span> <span style="color: #ff0000">Include</span><span style="color: #0000ff">=&quot;AssemblyInfo.cs&quot;</span> <span style="color: #ff0000">Condition</span><span style="color: #0000ff">=&quot;Exists(&#8217;AssemblyInfo.cs&#8217;)&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">Output</span> <span style="color: #ff0000">ItemName</span><span style="color: #0000ff">=&quot;Compile&quot;</span> <span style="color: #ff0000">TaskParameter</span><span style="color: #0000ff">=&quot;Include&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CreateItem</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Target</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>As you probably noticed AssemblyInfo.cs has been compiled with our project although it is not visible in Solution Explorer. </p>

<p>It will be good if all our projects in solution will have generated such information in the same manner. Let&#8217;s do some refactoring of our project file and make external helper file, which I usually call &quot;Common.proj&quot;. Make &quot;Common.proj&quot; looks like this &#8230;</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">=&quot;1.0&quot;</span> <span style="color: #ff0000">encoding</span><span style="color: #0000ff">=&quot;utf-8&quot;</span>?<span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Project</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;</span> <span style="color: #ff0000">ToolsVersion</span><span style="color: #0000ff">=&quot;3.5&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>     </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     <span style="color: #008000">&lt;!&#8211; AssemblyInfo Properties &#8211;&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">AssemblyInfoFile</span><span style="color: #0000ff">&gt;</span>AssemblyInfo.cs<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AssemblyInfoFile</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>     </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span>     <span style="color: #008000">&lt;!&#8211; Add additional depends to Build target &#8211;&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">BuildDependsOn</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>             IncludeGeneratedAssemblyInfo;</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span>             $(BuildDependsOn)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">BuildDependsOn</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span>     </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">Target</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;IncludeGeneratedAssemblyInfo&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">CreateItem</span> <span style="color: #ff0000">Include</span><span style="color: #0000ff">=&quot;$(AssemblyInfoFile)&quot;</span> <span style="color: #ff0000">Condition</span><span style="color: #0000ff">=&quot;Exists(&#8217;$(AssemblyInfoFile)&#8217;)&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span>             <span style="color: #0000ff">&lt;</span><span style="color: #800000">Output</span> <span style="color: #ff0000">ItemName</span><span style="color: #0000ff">=&quot;Compile&quot;</span> <span style="color: #ff0000">TaskParameter</span><span style="color: #0000ff">=&quot;Include&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CreateItem</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  21:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Target</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Project</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>We used property &quot;BuildDependsOn&quot; in lines (10-15), which is used by &quot;Build&quot; target and contains list of depended&#160; targets. Now we don&#8217;t need to modify &quot;BeforeBuild&quot; target in .csproj file it will be enough to include &quot;Common.proj&quot; in .csproj file. You can read more about &quot;BuildDependsOn&quot; in - <a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fblogs.msdn.com%2Fmsbuild%2Farchive%2F2006%2F02%2F10%2F528822.aspx&amp;i=0&amp;c=55ac1c4b2a4a8d16be370369f25255da6011b533" target="_blank">How To: Add Custom Process at Specific Points During Build (Method #2)</a></p>

<p>Let&#8217;s edit beginning of our project file .csproj like this &#8230;</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Project</span> <span style="color: #ff0000">DefaultTargets</span><span style="color: #0000ff">=&quot;Build&quot;</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;</span> <span style="color: #ff0000">ToolsVersion</span><span style="color: #0000ff">=&quot;3.5&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">RootPath</span> <span style="color: #ff0000">Condition</span><span style="color: #0000ff">=&quot; &#8216;$(RootPath)&#8217; == &#8216;&#8217; &quot;</span><span style="color: #0000ff">&gt;</span>$(MSBuildProjectDirectory)..\..\..\..\<span style="color: #0000ff">&lt;/</span><span style="color: #800000">RootPath</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">Configuration</span> <span style="color: #ff0000">Condition</span><span style="color: #0000ff">=&quot; &#8216;$(Configuration)&#8217; == &#8216;&#8217; &quot;</span><span style="color: #0000ff">&gt;</span>Debug<span style="color: #0000ff">&lt;/</span><span style="color: #800000">Configuration</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> &#8230; cut &#8230;</pre>
  </div>
</div>

<p>&quot;RootPath&quot; property defined in line (3) is a helper property which points out on folder root of our solution tree where &quot;Common.proj&quot; and other helper files are located. As I mentioned earlier we don&#8217;t need to modify &quot;BeforeBuild&quot; so part of .cproj file will look like this &#8230;</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> &#8230; cut &#8230;</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Import</span> <span style="color: #ff0000">Project</span><span style="color: #0000ff">=&quot;$(MSBuildBinPath)\Microsoft.CSharp.targets&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Import</span> <span style="color: #ff0000">Project</span><span style="color: #0000ff">=&quot;$(RootPath)\Common.proj&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> <span style="color: #008000">&lt;!&#8211; To modify your build process, add your task inside one of the targets below and uncomment it. </span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span> <span style="color: #008000">     Other similar extension points exist, see Microsoft.Common.targets.</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span> <span style="color: #008000">&lt;Target Name=&quot;BeforeBuild&quot;&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> <span style="color: #008000">&lt;/Target&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span> <span style="color: #008000">&lt;Target Name=&quot;AfterBuild&quot;&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span> <span style="color: #008000">&lt;/Target&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span> <span style="color: #008000">&#8211;&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span> &#8230; cut &#8230;</pre>
  </div>
</div>

<p>&quot;Common.proj&quot; is just included in line (3). From this time only this file is needed to modify.</p>

<p>We will use target &quot;AssemblyInfo&quot; for generating assembly info file and target &quot;SvnInfo&quot; to reach for actual svn&#8217;s revision number. These tasks are included in <a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fmsbuildtasks.tigris.org%2F&amp;i=0&amp;c=c7217db3fdbf2032a73ced5f9c13c29105c8ea5e" target="_blank">MSBuild Community Tasks</a>.</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">=&quot;1.0&quot;</span> <span style="color: #ff0000">encoding</span><span style="color: #0000ff">=&quot;utf-8&quot;</span>?<span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Project</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;</span> <span style="color: #ff0000">ToolsVersion</span><span style="color: #0000ff">=&quot;3.5&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>     </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     <span style="color: #008000">&lt;!&#8211; AssemblyInfo Properties &#8211;&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">AssemblyInfoFile</span><span style="color: #0000ff">&gt;</span>AssemblyInfo.cs<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AssemblyInfoFile</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">AssemblyTitle</span><span style="color: #0000ff">&gt;</span>Title of my library.<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AssemblyTitle</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">AssemblyDescription</span><span style="color: #0000ff">&gt;</span>My Product made by Me.<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AssemblyDescription</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">AssemblyCompany</span><span style="color: #0000ff">&gt;</span>My Company Ltd.<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AssemblyCompany</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">AssemblyProduct</span><span style="color: #0000ff">&gt;</span>My Product<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AssemblyProduct</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">AssemblyVersion</span><span style="color: #0000ff">&gt;</span>1.0.0<span style="color: #0000ff">&lt;/</span><span style="color: #800000">AssemblyVersion</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span>     </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>     <span style="color: #008000">&lt;!&#8211; Add additional depends to Build target &#8211;&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">BuildDependsOn</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span>             IncludeGeneratedAssemblyInfo;</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>             $(BuildDependsOn)</pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">BuildDependsOn</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">PropertyGroup</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  21:</span>&#160; </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">Import</span> <span style="color: #ff0000">Project</span><span style="color: #0000ff">=&quot;$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  23:</span>&#160; </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  24:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">Target</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">=&quot;IncludeGeneratedAssemblyInfo&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  25:</span>         </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  26:</span>         <span style="color: #008000">&lt;!&#8211; Get the revision number of the local working copy &#8211;&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  27:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">SvnInfo</span> <span style="color: #ff0000">LocalPath</span><span style="color: #0000ff">=&quot;$(MSBuildProjectDirectory)&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  28:</span>             <span style="color: #0000ff">&lt;</span><span style="color: #800000">Output</span> <span style="color: #ff0000">TaskParameter</span><span style="color: #0000ff">=&quot;Revision&quot;</span> <span style="color: #ff0000">PropertyName</span><span style="color: #0000ff">=&quot;SvnRevision&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  29:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">SvnInfo</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  30:</span>         </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  31:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">AssemblyInfo</span> <span style="color: #ff0000">CodeLanguage</span><span style="color: #0000ff">=&quot;CS&quot;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  32:</span>             <span style="color: #ff0000">OutputFile</span><span style="color: #0000ff">=&quot;$(AssemblyInfoFile)&quot;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  33:</span>             <span style="color: #ff0000">AssemblyTitle</span><span style="color: #0000ff">=&quot;$(AssemblyTitle)&quot;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  34:</span>             <span style="color: #ff0000">AssemblyDescription</span><span style="color: #0000ff">=&quot;$(AssemblyDescription)&quot;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  35:</span>             <span style="color: #ff0000">AssemblyCompany</span><span style="color: #0000ff">=&quot;$(AssemblyCompany)&quot;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  36:</span>             <span style="color: #ff0000">AssemblyProduct</span><span style="color: #0000ff">=&quot;$(AssemblyProduct)&quot;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  37:</span>             <span style="color: #ff0000">AssemblyVersion</span><span style="color: #0000ff">=&quot;$(AssemblyVersion).$(SvnRevision)&quot;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  38:</span>             <span style="color: #ff0000">AssemblyFileVersion</span><span style="color: #0000ff">=&quot;$(AssemblyVersion).$(SvnRevision)&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  39:</span>&#160; </pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  40:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">CreateItem</span> <span style="color: #ff0000">Include</span><span style="color: #0000ff">=&quot;$(AssemblyInfoFile)&quot;</span> <span style="color: #ff0000">Condition</span><span style="color: #0000ff">=&quot;Exists(&#8217;$(AssemblyInfoFile)&#8217;)&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  41:</span>             <span style="color: #0000ff">&lt;</span><span style="color: #800000">Output</span> <span style="color: #ff0000">ItemName</span><span style="color: #0000ff">=&quot;Compile&quot;</span> <span style="color: #ff0000">TaskParameter</span><span style="color: #0000ff">=&quot;Include&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  42:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">CreateItem</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  43:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Target</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  44:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Project</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>.. and that&#8217;s the final version.</p>
<a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fwww.dotnetkicks.com%2Fkick%2F%3Furl%3Dhttp%253a%252f%252frod.blogsome.com%252f2008%252f02%252f21%252fcompiling-solution-in-visual-studio-with-generating-project-version-based-on-svn-revision%252f&amp;i=0&amp;c=e3b21367fe221add94dc9e523551e3f8353a56a3"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2frod.blogsome.com%2f2008%2f02%2f21%2fcompiling-solution-in-visual-studio-with-generating-project-version-based-on-svn-revision%2f&amp;border=000099&amp;fgcolor=0000CC&amp;bgcolor=66CCCC&amp;cfgcolor=000066" border="0" alt="kick it on DotNetKicks.com" /></a>]]></content:encoded>
			<wfw:commentRss>http://rod.blogsome.com/2008/02/21/compiling-solution-in-visual-studio-with-generating-project-version-based-on-svn-revision/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Applying ASP.NET 2.0 CSS Themes for Web Controls from DevExpress</title>
		<link>http://rod.blogsome.com/2008/02/14/applying-aspnet-20-css-themes-for-web-controls-from-devexpress/</link>
		<comments>http://rod.blogsome.com/2008/02/14/applying-aspnet-20-css-themes-for-web-controls-from-devexpress/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 20:30:39 +0000</pubDate>
		<dc:creator>rod</dc:creator>
		
	<category>DevExpress</category>
	<category>ASP.NET</category>
		<guid>http://rod.blogsome.com/2008/02/14/applying-aspnet-20-css-themes-for-web-controls-from-devexpress/</guid>
		<description><![CDATA[I&#8217;m using DXperience v2007 vol 3 web controls from DevExpress in my project. These controls rendering is based on CSS delivered by vendor. Of course every developer can easily deliver his own CSS files for custom rendering. All is described in &quot;How to use a sample CSS file together with the CssFilePath and CssPostfix properties&quot; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using DXperience v2007 vol 3 web controls from <a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fwww.devexpress.com&amp;i=0&amp;c=fbbc561d3adb62e1236ea4c54c96dbeb0728b04d">DevExpress</a> in my project. These controls rendering is based on CSS delivered by vendor. Of course every developer can easily deliver his own CSS files for custom rendering. All is described in <a href="http://rod.blogsome.com/go.php?u=http%3A%2F%2Fwww.devexpress.com%2FSupport%2FCenter%2FKB%2Fp%2FK18030.aspx&amp;i=0&amp;c=8a220165aed3a0427f210e5c2f64b009a10aa9d6" target="_blank">&quot;How to use a sample CSS file together with the CssFilePath and CssPostfix properties&quot;</a> knowledge base article. I recommend to read it first before following the rest of this text.</p>  <p>CSS files for DevExpress controls are passed to the browser by WebResource.axd if any of controls on page has empty CSSFilePath and CSSPostfix. Here is HTML head rendered for ASP.NET&#8217;s StyleSheetTheme &quot;WarmSky&quot;.</p>  <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">   <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">     <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&quot;stylesheet&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/css&quot;</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;/WebResource.axd?d=0pW-VO1NI7dfSm0O0Zq2ACMk4iRYek_Z5HOc04vPAnw8rKCun3Q8F4Pym8tFdctHHl4XQbUWFljcY6QXnl3p7siLCGDJ1iKxufw0w7iv7o1SPl7T7o3UZQUTi-mf3HfnnTK_ucsD_MJr-bXTL61n0g2&amp;amp;t=633379322277157280&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&quot;stylesheet&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/css&quot;</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;/WebResource.axd?d=0pW-VO1NI7dfSm0O0Zq2ADLPYMn7C88nFaD1LYCGrG_m7LNXR4VkbF6eCu4o_f7P_mjdqJx3sBZZrQ4bq76FtHEcj1_39ooWlWE2tPILiLqxFiQpwhIOKyztP9HejXbuTlRxa7U-fgC-XpX8zwnYmQ2&amp;amp;t=633379322285068656&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&quot;stylesheet&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/css&quot;</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;/WebResource.axd?d=0pW-VO1NI7dfSm0O0Zq2AMHyrkIXBazF7PZQtbA9x6A1Th7TVoM38ntOqyETlkyMPdYqI3W_YqfVOkNGOxuNNsjpxsJ17m3w-X4OU9YXQdI1&amp;amp;t=633379322298387808&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;../App_Themes/WarmSky/Styles/main.css&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/css&quot;</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&quot;stylesheet&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span>Some Title<span style="color: #0000ff">&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Good solution is to prepare CSS files for DevExpress controls and put them in theme folder. Then just make sure that all DevExpress controls in page has set CSSPostfix property. Of course it is quite boring to set properties on every DevExpress control in design time. To make it more automatic let&#8217;s create simple DXControlsHelper static class and put there method which applies theme to control.</p>

<div class="csharpcode-wrapper">
  <div class="csharpcode">
    <pre class="alt"><span class="lnum">   1:</span> <span class="rem">/// &lt;summary&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   2:</span> <span class="rem">/// Applies theme for DevExpressControl.</span></pre>

    <pre class="alt"><span class="lnum">   3:</span> <span class="rem">/// &lt;/summary&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   4:</span> <span class="rem">/// &lt;param name=&quot;control&quot;&gt;The control.&lt;/param&gt;</span></pre>

    <pre class="alt"><span class="lnum">   5:</span> <span class="rem">/// &lt;param name=&quot;themeName&quot;&gt;Name of the theme.&lt;/param&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   6:</span> <span class="kwrd">internal</span> <span class="kwrd">static</span> <span class="kwrd">void</span> ApplyThemeToControl(ASPxWebControl control, <span class="kwrd">string</span> themeName)</pre>

    <pre class="alt"><span class="lnum">   7:</span> {</pre>

    <pre class="alteven"><span class="lnum">   8:</span>     <span class="kwrd">if</span>(control == <span class="kwrd">null</span>)</pre>

    <pre class="alt"><span class="lnum">   9:</span>         <span class="kwrd">return</span>;</pre>

    <pre class="alteven"><span class="lnum">  10:</span>&#160; </pre>

    <pre class="alt"><span class="lnum">  11:</span>     <span class="kwrd">if</span>(String.IsNullOrEmpty(themeName))</pre>

    <pre class="alteven"><span class="lnum">  12:</span>     {</pre>

    <pre class="alt"><span class="lnum">  13:</span>         control.CssPostfix = <span class="kwrd">null</span>;</pre>

    <pre class="alteven"><span class="lnum">  14:</span>         control.CssFilePath = <span class="kwrd">null</span>;</pre>

    <pre class="alt"><span class="lnum">  15:</span>     }</pre>

    <pre class="alteven"><span class="lnum">  16:</span>     <span class="kwrd">else</span></pre>

    <pre class="alt"><span class="lnum">  17:</span>     {</pre>

    <pre class="alteven"><span class="lnum">  18:</span>         control.CssPostfix = themeName;</pre>

    <pre class="alt"><span class="lnum">  19:</span>         <span class="rem">// control.CssFilePath = &quot;~/App_Themes/&quot; + themeName + &quot;/DXControls/{0}/styles.css&quot;;</span></pre>

    <pre class="alteven"><span class="lnum">  20:</span>     }</pre>

    <pre class="alt"><span class="lnum">  21:</span> }</pre>
  </div>
</div>

<p>This method sets only CssPostfix property because we&#8217;ve put DXControls CSS files in Theme folder so they will be automatically included during page rendering. That&#8217;s why line (19) is commented out.</p>

<p>Now it&#8217;s is time to deliver all DXControls from the page. To make sure that we will deliver all controls let&#8217;s make some recursive method to find all of them. To make it more universal let&#8217;s use generics.</p>

<div class="csharpcode-wrapper">
  <div class="csharpcode">
    <pre class="alt"><span class="lnum">   1:</span> <span class="rem">/// &lt;summary&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   2:</span> <span class="rem">/// Finds recursively all controls of defined type.</span></pre>

    <pre class="alt"><span class="lnum">   3:</span> <span class="rem">/// &lt;/summary&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   4:</span> <span class="rem">/// &lt;typeparam name=&quot;TControlType&quot;&gt;The type of the control type.&lt;/typeparam&gt;</span></pre>

    <pre class="alt"><span class="lnum">   5:</span> <span class="rem">/// &lt;param name=&quot;root&quot;&gt;The root.&lt;/param&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   6:</span> <span class="rem">/// &lt;returns&gt;List of controls.&lt;/returns&gt;</span></pre>

    <pre class="alt"><span class="lnum">   7:</span> <span class="kwrd">internal</span> <span class="kwrd">static</span> IEnumerable&lt;TControlType&gt; FindAllControlsRecursively&lt;TControlType&gt;(Control root)</pre>

    <pre class="alteven"><span class="lnum">   8:</span>     <span class="kwrd">where</span> TControlType : Control</pre>

    <pre class="alt"><span class="lnum">   9:</span> {</pre>

    <pre class="alteven"><span class="lnum">  10:</span>     <span class="kwrd">if</span>(root == <span class="kwrd">null</span>)</pre>

    <pre class="alt"><span class="lnum">  11:</span>         <span class="kwrd">yield</span> <span class="kwrd">return</span> <span class="kwrd">null</span>;</pre>

    <pre class="alteven"><span class="lnum">  12:</span>&#160; </pre>

    <pre class="alt"><span class="lnum">  13:</span>     <span class="kwrd">foreach</span>(Control item <span class="kwrd">in</span> root.Controls)</pre>

    <pre class="alteven"><span class="lnum">  14:</span>     {</pre>

    <pre class="alt"><span class="lnum">  15:</span>         <span class="kwrd">if</span> (item <span class="kwrd">is</span> TControlType)</pre>

    <pre class="alteven"><span class="lnum">  16:</span>             <span class="kwrd">yield</span> <span class="kwrd">return</span> item <span class="kwrd">as</span> TControlType;</pre>

    <pre class="alt"><span class="lnum">  17:</span>         <span class="kwrd">foreach</span> (TControlType itemChild <span class="kwrd">in</span> FindAllControlsRecursively&lt;TControlType&gt;(item))</pre>

    <pre class="alteven"><span class="lnum">  18:</span>             <span class="kwrd">yield</span> <span class="kwrd">return</span> itemChild;</pre>

    <pre class="alt"><span class="lnum">  19:</span>     }</pre>

    <pre class="alteven"><span class="lnum">  20:</span> }</pre>
  </div>
</div>

<p>Now it is time to apply theme to all controls. Hmm &#8230; maybe not to all &#8230;</p>

<div class="csharpcode-wrapper">
  <div class="csharpcode">
    <pre class="alt"><span class="lnum">   1:</span> <span class="rem">/// &lt;summary&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   2:</span> <span class="rem">/// Applies theme to all child DXControls from root.</span></pre>

    <pre class="alt"><span class="lnum">   3:</span> <span class="rem">/// &lt;/summary&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   4:</span> <span class="rem">/// &lt;param name=&quot;root&quot;&gt;The root.&lt;/param&gt;</span></pre>

    <pre class="alt"><span class="lnum">   5:</span> <span class="rem">/// &lt;param name=&quot;themeName&quot;&gt;Name of the theme.&lt;/param&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   6:</span> <span class="kwrd">internal</span> <span class="kwrd">static</span> <span class="kwrd">void</span> ApplyThemeToControlsRecursively(Control root, <span class="kwrd">string</span> themeName)</pre>

    <pre class="alt"><span class="lnum">   7:</span> {</pre>

    <pre class="alteven"><span class="lnum">   8:</span>     <span class="kwrd">foreach</span> (ASPxWebControl item <span class="kwrd">in</span> FindAllControlsRecursively&lt;ASPxWebControl&gt;(root))</pre>

    <pre class="alt"><span class="lnum">   9:</span>     {</pre>

    <pre class="alteven"><span class="lnum">  10:</span>         <span class="kwrd">if</span>(String.IsNullOrEmpty(item.CssPostfix) &amp;&amp; String.IsNullOrEmpty(item.CssFilePath))</pre>

    <pre class="alt"><span class="lnum">  11:</span>             ApplyThemeToControl(item, themeName);</pre>

    <pre class="alteven"><span class="lnum">  12:</span>     }</pre>

    <pre class="alt"><span class="lnum">  13:</span> }</pre>
  </div>
</div>

<p>Line (10) checks if control has already set one of property, for example in design mode then theme will not be applied to such control. Last step is to modify BasePage like this &#8230;</p>

<div class="csharpcode-wrapper">
  <div class="csharpcode">
    <pre class="alt"><span class="lnum">   1:</span> <span class="rem">/// &lt;summary&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   2:</span> <span class="rem">/// Handles the Render event of the Page control.</span></pre>

    <pre class="alt"><span class="lnum">   3:</span> <span class="rem">/// &lt;/summary&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   4:</span> <span class="rem">/// &lt;param name=&quot;sener&quot;&gt;The source of the event.&lt;/param&gt;</span></pre>

    <pre class="alt"><span class="lnum">   5:</span> <span class="rem">/// &lt;param name=&quot;e&quot;&gt;The &lt;see cref=&quot;System.EventArgs&quot;/&gt; instance containing the event data.&lt;/param&gt;</span></pre>

    <pre class="alteven"><span class="lnum">   6:</span> <span class="kwrd">protected</span> <span class="kwrd">virtual</span> <span class="kwrd">void</span> Page_PreRender(<span class="kwrd">object</span> sender, EventArgs e)</pre>

    <pre class="alt"><span class="lnum">   7:</span> {</pre>

    <pre class="alteven"><span class="lnum">   8:</span>     DXControlsHelper.ApplyThemeToControlsRecursively(<span class="kwrd">this</span>.Master, <span class="kwrd">this</span>.Page.StyleSheetTheme);</pre>

    <pre class="alt"><span class="lnum">   9:</span> }</pre>
  </div>
</div>

<p>.. now HTML header of rendered page looks like this.</p>

<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; max-height: 200px">
  <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;../App_Themes/WarmSky/DXControls/Editors/styles.css&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/css&quot;</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&quot;stylesheet&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;../App_Themes/WarmSky/DXControls/GridView/styles.css&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/css&quot;</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&quot;stylesheet&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;../App_Themes/WarmSky/DXControls/Web/styles.css&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/css&quot;</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&quot;stylesheet&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;../App_Themes/WarmSky/Styles/main.css&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text/css&quot;</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&quot;stylesheet&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span>Title<span style="color: #0000ff">&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>]]></content:encoded>
			<wfw:commentRss>http://rod.blogsome.com/2008/02/14/applying-aspnet-20-css-themes-for-web-controls-from-devexpress/feed/</wfw:commentRss>
	</item>
	</channel>
</rss>
