<?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>SDNET - all about .NET and computing &#187; admin</title>
	<atom:link href="http://sorin.serbans.net/blog/index.php/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://sorin.serbans.net/blog</link>
	<description>Look at the spoon ... There are no bugs</description>
	<lastBuildDate>Thu, 26 Jan 2012 13:08:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Robocopy supress error codes</title>
		<link>http://sorin.serbans.net/blog/index.php/2012/01/26/robocopy-supress-error-codes/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2012/01/26/robocopy-supress-error-codes/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 13:08:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=297</guid>
		<description><![CDATA[I have been working alot lately with Virtual Lab and automatic builds and deployment and today I learned something new 1. xcopy32 does not work on network shares (unless they are mapped to a drive) 2. robocopy messes up deploys because it can return an errorcode different from 0 even if it is just to [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working alot lately with Virtual Lab and automatic builds and deployment and today I learned something new<br />
1. xcopy32 does not work on network shares (unless they are mapped to a drive)<br />
2. robocopy messes up deploys because it can return an errorcode different from 0 even if it is just to tell you that he succeeded.</p>
<p>Now robocopy is replacing xcopy in my book and to make robocopy play nice, I add <b>^&#038; exit 0</b> at the end. Like this:</p>
<p><code><br />
robocopy \\networkdrive destpath *.* ^&#038; exit 0<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2012/01/26/robocopy-supress-error-codes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server Management Studio 2008 running slow</title>
		<link>http://sorin.serbans.net/blog/index.php/2011/12/22/sql-server-management-studio-2008-running-slow/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2011/12/22/sql-server-management-studio-2008-running-slow/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 08:07:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=294</guid>
		<description><![CDATA[When running SQL Server Management Studio 2008 on a Win7 64bit machine you might stumble upon poor, very poor performance. Clicking on a table results in waiting for 10-20 seconds before being able to do anything, doing a select would again take an eternity. The reason is unknown to me (sorry, I don&#8217;t feel like [...]]]></description>
			<content:encoded><![CDATA[<p>When running SQL Server Management Studio 2008 on a Win7 64bit machine you might stumble upon poor, very poor performance. Clicking on a table results in waiting for 10-20 seconds before being able to do anything, doing a select would again take an eternity. The reason is unknown to me (sorry, I don&#8217;t feel like reading tons of articles and kb notes).</p>
<p>Still I got it fixed. Just two steps:<br />
- set the management studio to run in XP SP3 compatibility mode<br />
- if you have the UAC turned off, turn it on on the first level (raise the level from the bottom one notch)</p>
<p>Now it&#8217;s working like a charm.</p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2011/12/22/sql-server-management-studio-2008-running-slow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMLab &#8211; notes to self</title>
		<link>http://sorin.serbans.net/blog/index.php/2011/10/25/vmlab-notes-to-self/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2011/10/25/vmlab-notes-to-self/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 06:38:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=286</guid>
		<description><![CDATA[On the &#8220;to be deployed&#8221; machine install: Lab Agent, Test Agent, Build Agent When creating the template on which the &#8220;to be deployed&#8221; machine will be based, make sure it is not set with a virtual network Install virtual guest services on the virtual machine before converting it to a template On the test controller [...]]]></description>
			<content:encoded><![CDATA[<p>On the &#8220;to be deployed&#8221; machine install: Lab Agent, Test Agent, Build Agent<br />
When creating the template on which the &#8220;to be deployed&#8221; machine will be based, make sure it is not set with a virtual network<br />
Install virtual guest services on the virtual machine before converting it to a template<br />
On the test controller set the dns append suffix to the domain where the test agents reside (they try to default to the name and not to the FDQN). Do the same on the test agent to be able to resolve the testcontroller<br />
Set the test agent to run as a service and using an administrator account.</p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2011/10/25/vmlab-notes-to-self/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to delete a work item from TFS</title>
		<link>http://sorin.serbans.net/blog/index.php/2011/09/16/how-to-delete-a-work-item-from-tfs/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2011/09/16/how-to-delete-a-work-item-from-tfs/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 07:56:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=282</guid>
		<description><![CDATA[Nice and usefull one: 1. Open Command prompt 2. Go to Program Files (x86)\Microsoft visual Studio 10.0\Common7\IDE (or in 9.0 if you are using VS2008) 3. run witadmin.exe destroywi /collection:http://[tfsurl]:8080/[collection] /id:workitemid where workitemid is the id given to the workitem by TFS You can also see the documentation here]]></description>
			<content:encoded><![CDATA[<p>Nice and usefull one:<br />
1. Open Command prompt<br />
2. Go to Program Files (x86)\Microsoft visual Studio 10.0\Common7\IDE (or in 9.0 if you are using VS2008)<br />
3. run <strong>witadmin.exe destroywi /collection:http://[tfsurl]:8080/[collection] /id:workitemid</strong></p>
<p>where workitemid is the id given to the workitem by TFS</p>
<p>You can also see the documentation <a href="http://msdn.microsoft.com/en-us/library/dd312129.aspx" title="here">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2011/09/16/how-to-delete-a-work-item-from-tfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google buys Motorola mobile &#8211; rejoice!</title>
		<link>http://sorin.serbans.net/blog/index.php/2011/08/17/google-buys-motorola-mobile-rejoice/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2011/08/17/google-buys-motorola-mobile-rejoice/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 18:50:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/index.php/2011/08/17/google-buys-motorola-mobile-rejoice/</guid>
		<description><![CDATA[Ok, for anyone that knows me the title sounds strange, but it should not. The reason is there so bear with me. I thought alot on this. I am in holiday and the news intrigued me to say the least. There has been alot of discussion and debate on the reason, starting from patent needs [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, for anyone that knows me the title sounds strange, but it should not. The reason is there so bear with me.</p>
<p>I thought alot on this. I am in holiday and the news intrigued me to say the least.<br />
There has been alot of discussion and debate on the reason, starting from patent needs (motorola has 17000 patents and counting) to support infrastructure and enterprise targetting. I am more interested in the outcome. With this move we are witnessing a stalemate on the three side war. We have Microsoft Nokia, Apple and now Google Motorola. Of the three, only Apple is low on patents compared to the others, but they have alot of new ones and also important ones, and their powerfull market possition. This leads as I said to a stalemate with each side not in a power possition. What is going to happen next?<br />
Well, all of them want market share and the only way to achieve that is through technological breakthroughs and services! As I said: rejoice. Good times are coming for smartphone users. </p>
<p>What I see: Mikrokia will deliver, Googrola will finally bring order in the chaos that is android and Apple will begin to listen and diminish the Jobs tax</p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2011/08/17/google-buys-motorola-mobile-rejoice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Process kills developer passion &#8211; my take</title>
		<link>http://sorin.serbans.net/blog/index.php/2011/05/17/process-kills-developer-passion-my-take/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2011/05/17/process-kills-developer-passion-my-take/#comments</comments>
		<pubDate>Tue, 17 May 2011 13:45:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=276</guid>
		<description><![CDATA[A few days ago I came upon an article by James Turner about processes killing developers passion and which when you read you get like &#8220;whoa, he&#8217;s right!&#8221;. It can be easy to fall for this kind of trap and which is why I try to counter it. Developer passion is indeed one of the [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I came upon an article by <a href="http://radar.oreilly.com/2011/05/process-kills-developer-passion.html">James Turner</a> about processes killing developers passion and which when you read you get like &#8220;whoa, he&#8217;s right!&#8221;.<br />
It can be easy to fall for this kind of trap and which is why I try to counter it.<br />
Developer passion is indeed one of the great assets a software company needs, but in the end, we &#8211; software developers &#8211; need to deliver what our client needs. In the 21 century this means large scale enterprise applications, large multiplayer games and the likes, essentially software that require more than 2 people locked in a basement to develop. This is where the need for processes arises, because no two developers are the same. Each favors a certain technique or way of doing things and this leads to &#8230; problems. Processes, if implemented right will make sure all developers have the knowledge they need, will allow for estimates and plans, such that the client knows when he receives his product. Even more, processes make sure that the product has the quality required by the customer, not the quality perceived by the developers. We all know this <a href="http://onproductmanagement.net/wp-content/uploads/2010/08/treecomicbig.jpg">picture</a>. In order to counter something similar to happen we put grooming in place, we get planning sessions and make sure the customer is always close by to check that we do what he thinks he wants.<br />
I can understand that processes might be poorly designed and make the developer&#8217;s life harder instead of making it easier, but this is like saying that in Europe is most of the time raining because it is so in UK. I do PQA (process quality assurance) and I always have to ask myself: &#8220;do we need to apply this process as it is or change it in such a way as to get the same results and not to burden the developers?&#8221;.</p>
<p>Let us suppose you are a bank and need a new backend system. Your bank will move billions each day. What do you do? Will you choose a small very &#8220;passionate&#8221; company, or go for one that has processes in place and are transparent in their work and give you measurements about productivity and quality?<br />
Of course, your company might not be a bank, and you do not expect something great, only something that it works and fast. Jump on the passionate wagon, they will certainly deliver.</p>
<p>Maybe the real problem resides in &#8220;when&#8221; should you apply all the TDD, reviews, processes, measurements and the like. I can only say: do what is needed to achieve your goals. If the goal is &#8220;zero defects&#8221; (I don&#8217;t agree with that but that&#8217;s another story) then go for the full-blown processes approach. If you need something fast, get a senior and a few devs and juniors, give them free hand and you are done.</p>
<p>Today I was chatting with someone from the company about the same article and he said: &#8220;if someone thinks that putting 5 guru&#8217;s in a team and letting them just do the product will work, I am willing to bet ALOT against it happening&#8221;; and I tend to agree, unless they devise their processes and plan the project to a certain degree, which if they are passionate enough &#8211; will not happen.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2011/05/17/process-kills-developer-passion-my-take/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TFS build and ASP.Net MVC</title>
		<link>http://sorin.serbans.net/blog/index.php/2010/11/24/tfs-build-and-asp-net-mvc/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2010/11/24/tfs-build-and-asp-net-mvc/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 09:32:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=267</guid>
		<description><![CDATA[Simply put: &#8220;it does not work out of the box&#8221;. Building the MVC website on the development desktop is ok. When checking the code and building using the TFS it crashes: [Any CPU/Release] /temp/global.asax(1,0): error ASPPARSE: Could not load type 'TestMVCApp.MvcApplication'. The reason is simple but not easy to find out. It seems the AspNetCompiler [...]]]></description>
			<content:encoded><![CDATA[<p>Simply put: &#8220;it does not work out of the box&#8221;. Building the MVC website on the development desktop is ok. When checking the code and building using the TFS it crashes:</p>
<pre class="csharpcode">
[Any CPU/Release] /temp/global.asax(1,0): error ASPPARSE: Could not
load type 'TestMVCApp.MvcApplication'.</pre>
<p>The reason is simple but not easy to find out. It seems the AspNetCompiler expects the dll&#8217;s to be found in the Bin directory and TFS puts the output in a different folder. Thus the AfterCompile step fails. To fix this we need to change (using notepad) the csproj of the web project. </p>
<p>Original:</p>
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">Target</span> <span class="attr">Name</span><span class="kwrd">="AfterBuild"</span> <span class="attr">Condition</span><span class="kwrd">="'$(MvcBuildViews)'=='true'"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">AspNetCompiler</span> <span class="attr">VirtualPath</span><span class="kwrd">="temp"</span> <span class="attr">PhysicalPath</span><span class="kwrd">="$(ProjectDir)"</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">Target</span><span class="kwrd">&gt;</span></pre>
<p>Fixed version:</p>
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">Target</span> <span class="attr">Name</span><span class="kwrd">="AfterBuild"</span> <span class="attr">Condition</span><span class="kwrd">="'$(MvcBuildViews)'=='true'"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">AspNetCompiler</span> <span class="attr">Condition</span><span class="kwrd">="'$(IsDesktopBuild)' != 'false'"</span>
     <span class="attr">VirtualPath</span><span class="kwrd">="temp"</span>
     <span class="attr">PhysicalPath</span><span class="kwrd">="$(ProjectDir)\..\$(ProjectName)"</span> <span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">AspNetCompiler</span> <span class="attr">Condition</span><span class="kwrd">="'$(IsDesktopBuild)' == 'false'"</span>
     <span class="attr">VirtualPath</span><span class="kwrd">="temp"</span>
     <span class="attr">PhysicalPath</span><span class="kwrd">="$(PublishDir)\_PublishedWebsites\$(ProjectName)"</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">Target</span><span class="kwrd">&gt;</span></pre>
<p>Hopefully MS will fix this in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2010/11/24/tfs-build-and-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE9 Beta is out. Impressed &#8211; unfortunately no.</title>
		<link>http://sorin.serbans.net/blog/index.php/2010/09/17/ie9-beta-is-out-impressed-unfortunately-no/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2010/09/17/ie9-beta-is-out-impressed-unfortunately-no/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 08:26:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=264</guid>
		<description><![CDATA[Well I was expecting this beta and then some. Unfortunately I am disappointed. After the fine beta that was Win7 this feels rushed. Here are my &#8220;bad&#8221; points: - address bar is skewed, again. I simply cannot choose from the last lets say 20 url&#8217;s entered and there is no way to do this. Think [...]]]></description>
			<content:encoded><![CDATA[<p>Well I was expecting this beta and then some. Unfortunately I am disappointed. After the fine beta that was Win7 this feels rushed. </p>
<p>Here are my &#8220;bad&#8221; points:<br />
- address bar is skewed, again. I simply cannot choose from the last lets say 20 url&#8217;s entered and there is no way to do this. Think about::config in firefox<br />
- the page tabs are squeezed on the right of the address bar. Excuse me! Where do I fit my usual 10 tabs. Group them? No, I don&#8217;t want that.<br />
- page loading is simply unintuitive. I have no feedback on the status and from 10 pages at least 2 fail to load. No error message just a blank page</p>
<p>The good points (yes there are some):<br />
- the interface is nice, feels more aero-like<br />
- the perceived performance (once you actually get to see something) is good</p>
<p>I was planning to switch to IE9 from Firefox (the damned resource hog) but it is not there yet. Waiting for beta 2.</p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2010/09/17/ie9-beta-is-out-impressed-unfortunately-no/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to read PDB files</title>
		<link>http://sorin.serbans.net/blog/index.php/2010/08/10/how-to-read-pdb-files/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2010/08/10/how-to-read-pdb-files/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 14:07:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=257</guid>
		<description><![CDATA[A long time ago I was looking on how to process pdb files in order to get additional information that reflection simply could not provide. Now I stumped over a 5 year old post of Mike Stall (here) and suddenly all became clear. I&#8217;ve put together a small example which uses .net 4.0 to read [...]]]></description>
			<content:encoded><![CDATA[<p>A long time ago I was looking on how to process pdb files in order to get additional information that reflection simply could not provide.<br />
Now I stumped over a 5 year old post of Mike Stall (<a href="http://blogs.msdn.com/b/jmstall/archive/2005/08/25/sample-pdb2xml.aspx">here</a>) and suddenly all became clear. I&#8217;ve put together a small example which uses .net 4.0 to read the method body code as it is in the source code from where the assembly was compiled. Mind you that in order for this to work you have to have the pdb of the assembly available. Also please make sure you add a refference to ISymWrapper and your project is targeting .Net 4.0 framework, not .Net 4.0 Client.</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
<span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Diagnostics.SymbolStore;
<span class="kwrd">using</span> System.IO;
<span class="kwrd">using</span> System.Reflection;
<span class="kwrd">using</span> System.Runtime.InteropServices;

<span class="kwrd">namespace</span> PdbTest
{
    <span class="kwrd">class</span> Program
    {
        <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)
        {
            Assembly ass = Assembly.GetExecutingAssembly();
            ISymbolReader symreader = SymUtil.GetSymbolReaderForFile(ass.Location, <span class="kwrd">null</span>);

            MethodInfo m = ass.GetType(<span class="str">"PdbTest.TestClass"</span>).GetMethod(<span class="str">"GetStringRepresentation"</span>);
            ISymbolMethod met = symreader.GetMethod(<span class="kwrd">new</span> SymbolToken(m.MetadataToken));

            <span class="kwrd">int</span> count = met.SequencePointCount;

            ISymbolDocument[] docs = <span class="kwrd">new</span> ISymbolDocument[count];
            <span class="kwrd">int</span>[] offsets = <span class="kwrd">new</span> <span class="kwrd">int</span>[count];
            <span class="kwrd">int</span>[] lines = <span class="kwrd">new</span> <span class="kwrd">int</span>[count];
            <span class="kwrd">int</span>[] columns = <span class="kwrd">new</span> <span class="kwrd">int</span>[count];
            <span class="kwrd">int</span>[] endlines = <span class="kwrd">new</span> <span class="kwrd">int</span>[count];
            <span class="kwrd">int</span>[] endcolumns = <span class="kwrd">new</span> <span class="kwrd">int</span>[count];

            met.GetSequencePoints(offsets, docs, lines, columns, endlines, endcolumns);

            StreamReader reader = <span class="kwrd">new</span> StreamReader(docs[0].URL);
            <span class="kwrd">string</span>[] linesOfCode = reader.ReadToEnd().Split(<span class="str">'\n'</span>);
            reader.Close();

            Console.WriteLine(<span class="str">"The content of method PdbTest.TestClass.GetStringRepresentation"</span>);
            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = lines[0]; i &lt; endlines[count - 1] - 1; i++)
            {
                Console.WriteLine(linesOfCode[i]);
            }
        }
    }

    <span class="preproc">#region</span> test <span class="kwrd">class</span>

    <span class="kwrd">public</span> <span class="kwrd">enum</span> MyEnum
    {
        Apples,
        Oranges
    }

    <span class="kwrd">public</span> <span class="kwrd">partial</span> <span class="kwrd">class</span> TestClass
    {
        <span class="kwrd">public</span> <span class="kwrd">string</span> GetStringRepresentation(MyEnum e)
        {
            MyEnum e2 = MyEnum.Apples;
            <span class="kwrd">return</span> e.ToString() + e2.ToString();
        }
    }

    <span class="preproc">#endregion</span> test <span class="kwrd">class</span>

    <span class="preproc">#region</span> Get a symbol reader <span class="kwrd">for</span> the given module

    <span class="rem">// Encapsulate a set of helper classes to get a symbol reader from a file.</span>
    <span class="rem">// The symbol interfaces require an unmanaged metadata interface.</span>
    <span class="kwrd">static</span> <span class="kwrd">class</span> SymUtil
    {
        <span class="kwrd">static</span> <span class="kwrd">class</span> NativeMethods
        {
            [DllImport(<span class="str">"ole32.dll"</span>)]
            <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">extern</span> <span class="kwrd">int</span> CoCreateInstance(
                [In] <span class="kwrd">ref</span> Guid rclsid,
                [In, MarshalAs(UnmanagedType.IUnknown)] Object pUnkOuter,
                [In] <span class="kwrd">uint</span> dwClsContext,
                [In] <span class="kwrd">ref</span> Guid riid,
                [Out, MarshalAs(UnmanagedType.Interface)] <span class="kwrd">out</span> Object ppv);
        }

        <span class="rem">// Wrapper.</span>
        <span class="kwrd">public</span> <span class="kwrd">static</span> ISymbolReader GetSymbolReaderForFile(<span class="kwrd">string</span> pathModule, <span class="kwrd">string</span> searchPath)
        {
            <span class="kwrd">return</span> SymUtil.GetSymbolReaderForFile(
                <span class="kwrd">new</span> System.Diagnostics.SymbolStore.SymBinder(), pathModule, searchPath);
        }

        <span class="rem">// We demand Unmanaged code permissions because we're reading from the file </span>
        <span class="rem">// system and calling out to the Symbol Reader</span>
        <span class="rem">// @TODO - make this more specific.</span>
        [System.Security.Permissions.SecurityPermission(
            System.Security.Permissions.SecurityAction.Demand,
            Flags = System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]
        <span class="kwrd">public</span> <span class="kwrd">static</span> ISymbolReader GetSymbolReaderForFile(
           System.Diagnostics.SymbolStore.SymBinder binder, <span class="kwrd">string</span> pathModule, <span class="kwrd">string</span> searchPath)
        {
            <span class="rem">// Guids for imported metadata interfaces.</span>
            Guid dispenserClassID = <span class="kwrd">new</span> Guid(0xe5cb7a31, 0x7512, 0x11d2, 0x89,
                0xce, 0x00, 0x80, 0xc7, 0x92, 0xe5, 0xd8); <span class="rem">// CLSID_CorMetaDataDispenser</span>
            Guid dispenserIID = <span class="kwrd">new</span> Guid(0x809c652e, 0x7396, 0x11d2, 0x97, 0x71,
                0x00, 0xa0, 0xc9, 0xb4, 0xd5, 0x0c); <span class="rem">// IID_IMetaDataDispenser</span>
            Guid importerIID = <span class="kwrd">new</span> Guid(0x7dac8207, 0xd3ae, 0x4c75, 0x9b, 0x67,
                0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44); <span class="rem">// IID_IMetaDataImport</span>

            <span class="rem">// First create the Metadata dispenser.</span>
            <span class="kwrd">object</span> objDispenser;
            NativeMethods.CoCreateInstance(<span class="kwrd">ref</span> dispenserClassID, <span class="kwrd">null</span>, 1,
                <span class="kwrd">ref</span> dispenserIID, <span class="kwrd">out</span> objDispenser);

            <span class="rem">// Now open an Importer on the given filename. We'll end up passing this importer </span>
            <span class="rem">// straight through to the Binder.</span>
            <span class="kwrd">object</span> objImporter;
            IMetaDataDispenser dispenser = (IMetaDataDispenser)objDispenser;
            dispenser.OpenScope(pathModule, 0, <span class="kwrd">ref</span> importerIID, <span class="kwrd">out</span> objImporter);

            IntPtr importerPtr = IntPtr.Zero;
            ISymbolReader reader;
            <span class="kwrd">try</span>
            {
                <span class="rem">// This will manually AddRef the underlying object, so we need to </span>
                <span class="rem">// be very careful to Release it.</span>
                importerPtr = Marshal.GetComInterfaceForObject(objImporter,
                    <span class="kwrd">typeof</span>(IMetadataImport));

                reader = binder.GetReader(importerPtr, pathModule, searchPath);
            }
            <span class="kwrd">finally</span>
            {
                <span class="kwrd">if</span> (importerPtr != IntPtr.Zero)
                {
                    Marshal.Release(importerPtr);
                }
            }
            <span class="kwrd">return</span> reader;
        }
    }
    <span class="preproc">#region</span> Metadata Imports

    <span class="rem">// We can use reflection-only load context to use reflection to query for </span>
    <span class="rem">// metadata information rather</span>
    <span class="rem">// than painfully import the com-classic metadata interfaces.</span>
    [Guid(<span class="str">"809c652e-7396-11d2-9771-00a0c9b4d50c"</span>),
        InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [ComVisible(<span class="kwrd">true</span>)]
    <span class="kwrd">interface</span> IMetaDataDispenser
    {
        <span class="rem">// We need to be able to call OpenScope, which is the 2nd vtable slot.</span>
        <span class="rem">// Thus we need this one placeholder here to occupy the first slot..</span>
        <span class="kwrd">void</span> DefineScope_Placeholder();

        <span class="rem">//STDMETHOD(OpenScope)(                   // Return code.</span>
        <span class="rem">//LPCWSTR     szScope,                // [in] The scope to open.</span>
        <span class="rem">//  DWORD       dwOpenFlags,            // [in] Open mode flags.</span>
        <span class="rem">//  REFIID      riid,                   // [in] The interface desired.</span>
        <span class="rem">//  IUnknown    **ppIUnk) PURE;         // [out] Return interface on success.</span>
        <span class="kwrd">void</span> OpenScope([In, MarshalAs(UnmanagedType.LPWStr)] String szScope,
            [In] Int32 dwOpenFlags, [In] <span class="kwrd">ref</span> Guid riid,
            [Out, MarshalAs(UnmanagedType.IUnknown)] <span class="kwrd">out</span> Object punk);

        <span class="rem">// Don't need any other methods.</span>
    }

    <span class="rem">// Since we're just blindly passing this interface through managed code to the Symbinder, </span>
    <span class="rem">// we don't care about actually importing the specific methods.</span>
    <span class="rem">// This needs to be public so that we can call Marshal.GetComInterfaceForObject() on </span>
    <span class="rem">// it to get the underlying metadata pointer.</span>
    [Guid(<span class="str">"7DAC8207-D3AE-4c75-9B67-92801A497D44"</span>),
        InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [ComVisible(<span class="kwrd">true</span>)]
    [CLSCompliant(<span class="kwrd">true</span>)]
    <span class="kwrd">public</span> <span class="kwrd">interface</span> IMetadataImport
    {
        <span class="rem">// Just need a single placeholder method so that it doesn't complain</span>
        <span class="rem">// about an empty interface.</span>
        <span class="kwrd">void</span> Placeholder();
    }
    <span class="preproc">#endregion</span>

    <span class="preproc">#endregion</span> Get a symbol reader <span class="kwrd">for</span> the given module
}
</pre>
<p>Thanks Mike.</p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2010/08/10/how-to-read-pdb-files/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Configure build in TFS2010 and multiple build agents on the same build machine</title>
		<link>http://sorin.serbans.net/blog/index.php/2010/07/27/configure-build-in-tfs2010-and-multiple-build-agents-on-the-same-build-machine/</link>
		<comments>http://sorin.serbans.net/blog/index.php/2010/07/27/configure-build-in-tfs2010-and-multiple-build-agents-on-the-same-build-machine/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 13:16:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://sorin.serbans.net/blog/?p=249</guid>
		<description><![CDATA[I have to write this down for me and others. It&#8217;s a headache each time I do it and I imagine for others as well. The problem at hand is how to make a build definition for a solution (or a new build definition for a solution already having a build definition) which is build [...]]]></description>
			<content:encoded><![CDATA[<p>I have to write this down for me and others. It&#8217;s a headache each time I do it and I imagine for others as well. The problem at hand is how to make a build definition for a solution (or a new build definition for a solution already having a build definition) which is build on a build machine hosting multiple build agents (scenario not endorsed by Microsoft).</p>
<p>Here are the steps:</p>
<ol>
<li>If you don&#8217;t know what you are doing ask someone who does and go to step 10. If you don&#8217;t have someone to ask you can still proceed but at your own risk.
</li>
<li>Log on onto the build machine as an administrator (just to avoid pesky security checks)
</li>
<li>Go to c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies &#8211; this may vary due to the OS being 32 or 64 and if you&#8217;re using TFS2008 (you go to vs 9.0 directory) or if you&#8217;re using TFS2010 (you go to vs 10.0 directory)
</li>
<li>Copy TFSBuildService.exe as TFSBuildService2.exe (just make sure you have different executables for each build agent, I use numbers added to the name of the file)
</li>
<li>Copy TFSBuildService.exe.config as TFSBuildService2.exe.config (same logic as above)
</li>
<li>Edit TFSBuildService2.exe.config:
<ul>
<li>such that the <strong>&#8220;port&#8221;</strong> and <strong>&#8220;InteractivePort&#8221;</strong> have values not yet used. For the second agent these would be <strong>9193</strong> and <strong>9194</strong> which I will be using later in the process.
</li>
<li>Here you can also fool the build agent to use whatever version of MSBuild you want by modifying MSBuildPath. For example I use the MSBuild of .Net 4.0 on a TFS2008.
</li>
<li>Modify &#8220;SourcesSubdirectory&#8221; to &#8220;Sources\projectname&#8221; where projectname is an arbitrary value, just make sure it&#8217;s different for all build agents
</li>
<li>Modify &#8220;BinariesSubdirectory&#8221; to &#8220;Binaries\projectname&#8221; &#8211; same logic as above
</li>
<li>Modify &#8220;TestResultsSubdirectory&#8221; to &#8220;TestResults\projectname&#8221; &#8211; same logic as above
</li>
</ul>
</li>
<li>Create a service for the build agent. Open a visual studio command prompt (will save you to write fullpath to sc.exe) and run the command: <strong>sc create VSTFBUILD2 binpath= &#8220;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\TFSBuildService2.exe&#8221; displayname= &#8220;Visual Studio Team Foundation Build &#8211; projectName&#8221; start= auto</strong>. Observations:
<ul>
<li>
the name of the service VSTFBUILD2 should differ from all other build agent services and thus I added the 2 suffix
</li>
<li>the TFSBuildService2.exe should be the one you created at step 4
</li>
<li>the display name is not very important but helps in identifying the service in the service manager window
</li>
</ul>
</li>
<li>Go to service manager window (start\control panel\administrative tools\services), find your newly created service, go to properties, the log-on tab and modify there to make the service to log on as the <strong>TFSService </strong>(default account for the TFS). Make sure you&#8217;re using also the domain there if you are in a domain.
</li>
<li>Start the service
</li>
<li>Create a folder where the build results will be added. Something like &#8220;c:\b\pname&#8221;. Be carefull to choose as shorter names as possible to not hit the 240 char limit of TFS when getting all the source code. Share this folder with the people that need to access build results and make sure TFSService has full rights on it
</li>
<li>Log on to the TFS machine
</li>
<li>Start visual studio (must have team explorer installed).
</li>
<li>Use team explorer to navigate to your sollution and right click on the <strong>Builds </strong>and select <strong>Manage Build Agents</strong>. If you don&#8217;t see the option you may not have rights &#8211; get them.
</li>
<li>Click <strong>New</strong>. Choose a display name. I choose <strong>buildmachine_2</strong>. In the computer name add <strong>buildmachine</strong> and the communication port you set at step; in this case <strong>9193</strong>. Set the agent status to <strong>Enabled</strong> and finish.
</li>
<li>Log on to your development machine. Use team explorer and go to the builds folder of your sollution.
</li>
<li>Right click <strong>builds</strong> and choose <strong>New build definition</strong>.
<ul>
<li>Put a build definition name there,
</li>
<li>select the trigger,
</li>
<li>select the workspace (what needs to be retrieved by the source control) and put in the build agent folder the folder created at step 10.
</li>
<li>In the <strong>Build defaults</strong> select in the build controller dropdown <strong>buildmachine_2</strong> (if it is not yet visible there restart visual studio and try again). Also put into the build output folder textbox the UNC path to the share created as step 10.
</li>
<li>In the project file put the source control path to the  TFSBuild.proj if you have it already, if not you should be able to create it from this tab
</li>
<li>done here. After saving this you should see your build definition in the builds folder in team explorer.
</li>
</ul>
</li>
<li>In the TFSBuild.proj file (seen at last step of step 16) modify:
<ul>
<li>BuildMachine &#8211; <strong>buildmachine_2</strong> &#8211; this is just to make sure because it should be ignored normally
</li>
<li>BuildDirectoryPath &#8211; put the full name of the directory created at step 10 (not the UNC path! but the path as seen when logged-on on the build machine, like &#8220;c:\b\pname&#8221;)
</li>
</ul>
<li>Done. You should be able to queue a new build.
</li>
<p>Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://sorin.serbans.net/blog/index.php/2010/07/27/configure-build-in-tfs2010-and-multiple-build-agents-on-the-same-build-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

