<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Florent Clairambault &#187; assembly versions</title>
	<atom:link href="http://florent.clairambault.fr/tag/assembly-versions/feed" rel="self" type="application/rss+xml" />
	<link>http://florent.clairambault.fr</link>
	<description></description>
	<lastBuildDate>Sat, 04 Feb 2012 19:56:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
		<item>
		<title>C# .Net : How works automatic assembly versioning</title>
		<link>http://florent.clairambault.fr/c-net-how-works-automatic-assembly-versioning?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=c-net-how-works-automatic-assembly-versioning</link>
		<comments>http://florent.clairambault.fr/c-net-how-works-automatic-assembly-versioning#comments</comments>
		<pubDate>Sun, 21 Feb 2010 12:02:01 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[assembly versions]]></category>
		<category><![CDATA[C# .Net]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2388</guid>
		<description><![CDATA[When you choose to automatically generate a new version of your assembly at compilation, you have to set in the AssemblyInfo.cs file, this line : 1 2 3 4 5 6 7 8 9 10 // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // [...]]]></description>
			<content:encoded><![CDATA[<p>When you choose to automatically generate a new version of your assembly at compilation, you have to set in the AssemblyInfo.cs file, this line :</p>

<div class="wp_codebox"><table><tr id="p23883"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p2388code3"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// Version information for an assembly consists of the following four values:</span>
<span style="color: #008080; font-style: italic;">//</span>
<span style="color: #008080; font-style: italic;">//      Major Version</span>
<span style="color: #008080; font-style: italic;">//      Minor Version </span>
<span style="color: #008080; font-style: italic;">//      Build Number</span>
<span style="color: #008080; font-style: italic;">//      Revision</span>
<span style="color: #008080; font-style: italic;">//</span>
<span style="color: #008080; font-style: italic;">// You can specify all the values or you can default the Build and Revision Numbers </span>
<span style="color: #008080; font-style: italic;">// by using the '*' as shown below:</span>
<span style="color: #008000;">&#91;</span>assembly<span style="color: #008000;">:</span> AssemblyVersion<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;1.0.*&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span></pre></td></tr></table></div>

<p>But what do these automatically generated numbers mean ? Well, chances are you don&#8217;t care. But one day after using this features for years I decided that I would.</p>
<ul>
<li>The build number is the number of days since 01/01/2000</li>
<li>The revision number if the number of 2 seconds periods since 00:00 of this day</li>
</ul>
<p>So&#8230; To get the compilation date of an assembly from its version, you would have to do :</p>

<div class="wp_codebox"><table><tr id="p23884"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2388code4"><pre class="csharp" style="font-family:monospace;">var version <span style="color: #008000;">=</span> Assembly<span style="color: #008000;">.</span><span style="color: #0000FF;">GetExecutingAssembly</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetName</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Version</span><span style="color: #008000;">;</span>
var date <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> DateTime<span style="color: #008000;">&#40;</span> <span style="color: #FF0000;">2000</span>, 01, 01 <span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddDays</span><span style="color: #008000;">&#40;</span> version<span style="color: #008000;">.</span><span style="color: #0000FF;">Build</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddSeconds</span><span style="color: #008000;">&#40;</span> version<span style="color: #008000;">.</span><span style="color: #0000FF;">Revision</span> <span style="color: #008000;">*</span> <span style="color: #FF0000;">2</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>This feature is great if your need some atomic versionning of a particular library for instance. Each program using your library has its own version and you don&#8217;t risk to break working feature in future release of your library. And if you want to force the use of a newer version of a library within a particular application, you can use some <a href="http://msdn.microsoft.com/en-us/library/7wd6ex19(VS.71).aspx">assembly redirection</a>.<br />
But you should also note that if you deploy your assembly in the <a href="http://florent.clairambault.fr/tag/GAC">GAC</a> (like it&#8217;s required to do with Sharepoint), you will have tons of &#8220;garbage&#8221; versions of your assembly. And there&#8217;s not &#8220;easy fix&#8221; for that.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/c-net-how-works-automatic-assembly-versioning/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/13 queries in 0.005 seconds using disk: basic
Object Caching 398/408 objects using disk: basic

Served from: florent.clairambault.fr @ 2012-02-08 12:40:47 -->
