mandag 7. desember 2009

Changing TFS emails to link to Team System Web Access – Part 2 - Visual Studio Team System (VSTS) Blog - by Neno Loje

Neno Loje stated in Changing TFS emails to link to Team System Web Access – Part 2 - Visual Studio Team System (VSTS) Blog - by Neno Loje that:

"There are four areas to look at:
Work Item notification mails (has already been discussed here)
Build notification mails
Check-in notification mails
Mails sent by Team Explorer (feature of TFS 2008 SP1)
Area 1 is part of a separate blog post, for Area 2 there are currently no equivalent steps (as stated in KB956761)."

I just couldn't live with it so I made it work, like this in BuildCompletionEvent2.xsl:

   1:        <div class="Title">


   2:          <xsl:call-template name="link">


   3:            <xsl:with-param name="format" select="'html'"/>


   4:            <xsl:with-param name="embolden" select="'true'"/>


   5:            <xsl:with-param name="fontSize" select="'larger'"/>


   6:            <xsl:with-param name="link" select="concat(substring-before(Url,':8080/Build/Build.aspx?artifactMonike'),':8090/UI/Pages/Build/Details.aspx?builduri=vstfs%3A%2F%2F%2FBuild%2FBuild%2F',substring-after(Url,'artifactMoniker='))"/>


   7:            <xsl:with-param name="displayText" select="Title"/>


   8:          </xsl:call-template>


   9:        </div>




Where the point of the matter is line 11. The change was inspired by the original post by Neno and a simple fix.



To add even more we even changed it a bit more to include a link to a report over the failing tests for the last 72 hours. I am not showing the report part, but the take-away is the inclusion of the link:



 



   1:  <xsl:if test="StatusCode != 'Succeeded'">


   2:     <tr>


   3:       <td class="PropName">Build Log Location: </td>


   4:       <td class="PropValue">


   5:         <xsl:call-template name="link">


   6:           <xsl:with-param name="format" select="'html'"/>


   7:           <xsl:with-param name="embolden" select="'false'"/>


   8:           <xsl:with-param name="link" select="LogLocation"/>


   9:           <xsl:with-param name="displayText" select="LogLocation"/>


  10:         </xsl:call-template>


  11:       </td>


  12:     </tr>


  13:     <tr>


  14:       <xsl:call-template name="link">


  15:         <xsl:with-param name="format" select="'html'"/>


  16:         <xsl:with-param name="embolden" select="'true'"/>


  17:         <xsl:with-param name="fontSize" select="'larger'"/>


  18:         <xsl:with-param name="link" select="concat(substring-before(Url,':8080/Build/Build.aspx?artifactMonike'),'/ReportServer/Pages/ReportViewer.aspx?/Confirmit/Failed+Tests&rs%3aCommand=Render&BuildParam=',substring-after(Url,'artifactMoniker='))"/>


  19:         <xsl:with-param name="displayText" select="'Report on failing tests in this build'"/>


  20:       </xsl:call-template>


  21:     </tr>


  22:   </xsl:if>




The added code is the lines 13 – 21.



Happy coding

onsdag 19. august 2009

Update: Why it is an error for MSBuild to build clean in the same order as it builds regularily

In the two postings listed below I described how MSBuild is building the Clean target of a VS Solution in the wrong order.

Brumlemann: Why it is an error for MSBuild to build clean in the same order as it builds regularily

Brumlemann: MSbuild of VS solution under target clean is just plain wrong

I also created a Microsoft Connect issue on this behaviour and you can find that posting here:

Brumlemann: MSBuild builds the clean target of VS solution files in the wrong order

The Visual Studio team at Microsoft has since reckognized this as a bug and, as the connect issue shows, a fix has been reported to have been implemented for the next release of VS2010. At the time of writing it is post beta 1, so I guess beta 2 is 'next release'. I will be sure to verify this and report back on my findings.

lørdag 21. mars 2009

Analyzing the code base of CruiseControl.NET - Patrick Smacchia [MVP C#]

Analyzing the code base of CruiseControl.NET - Patrick Smacchia [MVP C#]

Once again Patrick delivers a good blog. His favourite is picking apart popular standard libraries. This time it's CruiseConrol that gets a runthrough.

The reason why I wanted to mention this post is that he sneaks in another topic that we agree strongly on, and even possitively feel a bit passionate about, namely
Copy Local
in Visual Studio project/Solutions. I had planned to blog about why this is a bad idea myself, but Patrick beat me to it. I guess beeing not so entangled in corporate life gives him the oppurtunity to set aside some more time to put things straight. Well done Patrick (again :).

Build task for searching in files

Technorati Tags: ,

Just to test out the code add-in I just added to Live Writer I thought I would share this little build task for filtering out files based on standard string search, with or without regular expressions. Disclaimer! The regular expression mode didn’t work as I had expected and my needs there and then didn’t exceed pure freetext search, so it may need some tweaking, and of course the usual use at own risk bla bla.

namespace YourNameSpace.BuildTasks
{
using System.Diagnostics;
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Build.Utilities;
using System.Text.RegularExpressions;
using Microsoft.Build.Framework;

/// <summary>
/// Finds files with a content that has one or more matches
/// for the pattern provided.
/// </summary>
public class FindFilesWithContent : Task
{
public FindFilesWithContent()
{
results = new List<TaskItem>();
} // Properties
[Required]
public ITaskItem[] FilesToSearch { get; set; }
[Required]
public string Pattern { get; set; }
public bool UseRegExp { get; set; }
private readonly List<TaskItem> results;
[Output]
public ITaskItem[] Results
{
get { return results.ToArray(); }
}
public override bool Execute()
{
if(UseRegExp) Log.LogMessage(MessageImportance.Low,
"Using regular expression", new object[] { null });
Log.LogMessage(MessageImportance.Low,
"Matching with pattern {0}", new object[] { Pattern });
foreach (ITaskItem taskItem in FilesToSearch)
{
if (!File.Exists(taskItem.ItemSpec))
{
Log.LogError("File does not exist: {0}",
new object[] { taskItem.ItemSpec });
}

//Read the whole text file to the end before closing it
StreamReader reader = new StreamReader(taskItem.ItemSpec);
string allRead = reader.ReadToEnd();
reader.Close();

Log.LogMessage(MessageImportance.Low,
"Content of file to match: {0}",
new object[] { allRead });

//Do the matching
if (Compare(allRead, Pattern))
{
results.Add(new TaskItem(taskItem));
Log.LogMessage(MessageImportance.Low,
"File matched: {0}",
new object[] { taskItem.ItemSpec });
}
else
Log.LogMessage(MessageImportance.Low,
"File did not match: {0}",
new object[] { taskItem.ItemSpec });
}
return true;
}

private bool Compare(string stringToSearch, string pattern)
{
if (UseRegExp)
return Regex.IsMatch(stringToSearch, pattern);
return stringToSearch.Contains(pattern);
}
}
}




The usage is as follows:





<!--UseRegExp="false" is default-->
<FindFilesWithContent
FilesToSearch="@(FilesToSearchWithin)"
Pattern="This string I will find"
UseRegExp="false">
<Output TaskParameter="Results"
ItemName="FilesThatHaveMatchingContent"/>
</FindFilesWithContent>





Blogging - Add-on galleri

Just installed IE8 and researching some of the new features. As a consequence I started using Live Writer. Time will tell if this is the cool way to blog. Seems nice enough though. Let’s try to add a picture

20032008060

Not exactly flattering but a test is a test. Now you all know what I look like, when I have worked to much overtime ;-)

Blogging - Add-on galleri

mandag 19. januar 2009

Challenges with TypeMock and Team Build

According to the TypeMock documentation it's a breeze to set up mocking during Team Build. Well I have just spent a week trying to get it to work and I think I finally cracked it. It all comes down to reading the f*** manual and believing it to be taken literally.

 

TypeMock location


The TypeMock manual say the following:
<!-- Use Typemock Isolator MsBuild Extensions -->
<Import Project="C:\Program Files\TypeMock\Typemock Isolator\TypeMock.MSBuild.tasks" />

<!-- Override this target to plugin custom tasks before running tests -->
<Target Name="BeforeTest">
<!-- Start TypeMock -->
<TypeMockStart/>
</Target>

<!-- Override this target to plugin custom tasks after running tests -->
<Target Name="AfterTest">
<!-- Quit TypeMock -->
<TypeMockStop/>
</Target>


Well first of all this isn't quite true. As of 5.1 (I think) TypeMock installs into another directory (C:\Program Files\Typemock\Isolator\5.2 in my case as we just upgraded to 5.2.1).  So you have to perform some trickery in your MSBuild files to detect whether your doing a build server or desktop build. Luckily there are ways to do this.

Anyway, this is not my main point. The main point is that you can get tricked by the way MSBuild is implemented and used during an EndToEndIteration build.

Where does the TypeMockRunner instance live?



What I saw was that my tests were running fine during DesktopBuild but failing miserably during E2EI (yes I ran a desktop build (msbuild TFSBuild.proj /t:test) on the build server and the tests ran fine). So that’s what I've been spending the last week trying to unravel. And here are the results from the Norwegian jury:

You must follow the instructions (above) from the TypeMock doc to the extent that you call TypeMockStart/TypeMockStop from TFSBuild.proj itself.


We have an existing build system (CruiseControl) so I was reusing my Test.proj calling the necessary targets from inside that. THIS WILL NOT WORK IN A TEAM BUILD CONTEXT! You have to call TypeMockStart from the same instance of MSBuild as the one you're running tests from (i.e. calling MSTest/TestToolsTask)!


Consequence: The multiple agents switch (/m) of MSTest is incompatible with TypeMock.


I had to disable building in parallel because of this. It has to be said that the guys at TypeMock are waiting for me to have some available time so we can look into this since this is obviously no more good for them than it is for me. Ay ve! So much to deal with and so little time.

tirsdag 6. januar 2009

Bug in how VS/VSTestHost loads symbols?

I have started running source server on our TFS build box. (blog about that later) and I just noticed a peculiarity in how the symbol files where loaded during a "Debug Checked Deploed Tests".

The two different findings arise when downloading the testresults from a team build.

It seems that when I started with an empty Visual Studio and from there opened the downloaded testrun the "Debug Checked Deployed Tests" handled the source server brialliantly and the debugger broke inside a copy of the versioned item, as expected.

However, when i HAD MY SOLUTION OPEN IN VISUAL STUDIO and the debugger breaks, it claims that there is no source available and the only choice it gave me was to open the dissambly. Now I',m curious so I open the Modules window, and there I see that the loaded pdb files are the correct ones (or so it seems). I open them in Notepad and they look correct.

Now the really strange thing happens when I hit F5. I get breaked at the next failing test and there everthing is ok, I get the downloaded versioned item opened and the debugger breaks at the correct location(?!?). Gotta investigate more on this. For now I will just list it as another mystery.

How to make VS 2008 swallow more memory

While wating for VS next (2010) which for sure will be 64Bit and massively concurrent on top of the new concurrency APIs in 4.0 (yeah right ;)) this one has been proved to work (thx to Steven Harman):

http://stevenharman.net/blog/archive/2008/04/29/hacking-visual-studio-to-use-more-than-2gigabytes-of-memory.aspx

This should make 4GB virtual memory (logical barrier for 32bit app) available (I think?) but it doesn't look that way. I seems to bump at 3GB virtual space now. It's still a massive improvement though and it makes my 100 project 1MLOC solution actually a bit snappy even with ReSharper running on all sylinders (even running solution wide analysis).

What about physical memory consumption? On my four core Windows 2008 Server 64Bit/8GB dev box I was hoping Stevens trick would release more physical memory than the 2GB it looks like its stopping at now. Anyone have one more trick up their sleeve to tweak the last logical GB out (and I would rather prefer electron flux (physical memory) over magnetic manipulation of iron dust (swap to disk)) while waiting for the above mentioned nirvana?

Actually I hardly see any disk activity at all. The dev box is equipped with a solid battery powered write cache (windows will take care of the read caching, thx Christian for correcting me on that little trivia ;)) in front of 10K+15K RPM disks :) Windows 2008 does a good job of caching stuff it needs in a situation like that. Cannot take the machine with me when I go home though (doesn't matter, I can remote it over VPN anyway).
----------------

Update: I think I have to try the same trick on ReSharper too (parts (most?) of it runs in it's own process) because I am still getting OutOfMemory execption from it.

mandag 5. januar 2009

Possible paralellism scheme in MSTest

While I am sitting here waiting for a test run to finish I might as well vent my frustration and hopefully spark up some ideas that might resonate with the Team Test crew in Redmond.

The possible paralellism in a run of MSBuild seems well under way to be taken care of and is now partly under the control of the user (pending disipline amongst the developers). Only yesterday I switched over to /m:8 on my 4 core build machine just to see what it would do to my build process and it was a sight for sore eyes seeing the 7+1 MSBuild processes firing at will on all four cores.

The only problem I have right now is that our code base is big and therefore divided into several VS solutions. Enabling cleaning of the output then tripped the whole wagon since it seems the solutions are batch-built as a whole. Since we have dependencies between the solutions the build order of the solutions must be observed. Too much goodies then so I switched back to single build process.

I have been working for a while on a single VS solution containing all our projects (8GB, 4Core developer blades with 15K + 10K RPM disks seems to be able to take the pain without too much(!) trouble), but thanks to some legacy(sic!) J# components (needs J#SE and VS2005) that seems hard to get rid of this is not a path that will be resolved for a while.

Meanwhile on the test side of things there is currently no free lunch up for grabs even from the product side let alone our own disipline. MSTest will allow you to specify whether tests should be run in separate containers or with no isolation, but it will not run the tests in paralell whatsoever (Google "mstest paralell" and be convinced).

IMHO this is definitely on the most wanted feature list for VS next (2010) and I hope to see it (haven't had enough time to check it out yet). In my dreams the feature would have these high level properties:

- MSTest switch to specify at which level the paralellism should take place
- The switch would take its value form the tuple {Solution|Assembly|Class|Method} (update: consider even TestList as a value)
- MSTest switch (like for MSBuild) to specify number of nodes (/m:)

It would be left to the developer to guarantee that the test units (not unit tests) at the given granularity observes independence of all other test units on that level. In other words, if I knew (because I have worked my behind of to get it like that) that all my [TestClass] adorned classes were completely isolated at runtime from all other [TestClass] classes, then I would specify /p:Isolation=Class in my test run. MSTest/VSTestHost would then run all tests in paralell on all available nodes and I wouldn't have to sit around looking at three out of four cores doing abolutely nothing while the tests take forever.

Now wouldn't that be great?

tirsdag 30. desember 2008

Why it is an error for MSBuild to build clean in the same order as it builds regularily

In a previous posting I wrote about the problem you sometimes face when using MSBuild to build VS solution files.

The investigation of this problem is now complete from my side and I have produced a short and sweet demo that illustrates the problem. The following necessary and sufficienct conditions apply:

- Two assemblies (Level0 and Level1)
- Level1 has a project reference to Level0 with Private=false (CopyLocal=false)
- Both projects have set OutputPath to a common directory (CopyLocal is an abomination and I will blog about why in the future)
- Level1 has "Register for COM interop" and [assembly: ComVisible(true)] in assemblyinfo.cs
- Level1 containing a type that inherits from a type in Level0. The inheriting type must have [ComVisible(false)] or the solution will not build.

The problem is of course that the inheritance across the assembly barrier means that the RegisterAssembly() and UnRegisterAssembly() methods of RegisterServices needs to load Level0 in order to resolve the types in Level1, even though the type that needs resolving is not to be registered for COM interop.

Inside the VS IDE this is no problem since VS in fact does build clean in the proper order, as the following output clearly shows:


------ Clean started: Project: Level1, Configuration: Debug Any CPU ------
------ Clean started: Project: Level0, Configuration: Debug Any CPU ------
========== Clean: 2 succeeded, 0 failed, 0 skipped ==========

MSBuild however does not do this properly, as the following ouput shows:

C:\Test\BuildDependencies>msbuild BuildDependencies.sln /t:clean /v:n
Microsoft (R) Build Engine Version 3.5.30729.1[Microsoft .NET Framework, Version 2.0.50727.3053]Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 12/30/2008 2:56:51 PM.Project "C:\Test\BuildDependencies\BuildDependencies.sln" on node 0 (clean target(s)). Building solution configuration "DebugAny CPU".Project "C:\Test\BuildDependencies\BuildDependencies.sln" (1) is building "C:\Test\BuildDependencies\Level0\Level0.csproj" (2) on node 0 (Clean target(s)). Deleting file "C:\Test\BuildDependencies\Binaries\Level0.dll". Deleting file "C:\Test\BuildDependencies\Binaries\Level0.pdb". Deleting file "C:\Test\BuildDependencies\Level0\obj\Debug\Level0.dll". Deleting file "C:\Test\BuildDependencies\Level0\obj\Debug\Level0.pdb".EntityClean: Successfully cleaned the output for 0 EDMX files.Done Building Project "C:\Test\BuildDependencies\Level0\Level0.csproj" (Clean target(s)).
Project "C:\Test\BuildDependencies\BuildDependencies.sln" (1) is building "C:\Test\BuildDependencies\Level1\Level1.csproj" (3) on node 0 (Clean target(s)).C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(928,9): error MSB3395: Cannot unregister assembly "C:\Test\BuildDependencies\Binaries\Level1.dll". Could not load file or assembly 'Level0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.Done Building Project "C:\Test\BuildDependencies\Level1\Level1.csproj" (Clean target(s)) -- FAILED.
Done Building Project "C:\Test\BuildDependencies\BuildDependencies.sln" (clean target(s)) -- FAILED.
Build FAILED.
"C:\Test\BuildDependencies\BuildDependencies.sln" (clean target) (1) ->"C:\Test\BuildDependencies\Level1\Level1.csproj" (Clean target) (3) ->(UnmanagedUnregistration target) -> C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(928,9): error MSB3395: Cannot unregister assembly "C:\Test\BuildDependencies\Binaries\Level1.dll". Could not load file or assembly 'Level0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
0 Warning(s) 1 Error(s)
Time Elapsed 00:00:00.54
C:\Test\BuildDependencies>

Which prooves my point (look closely at the output and you will see that the projects are cleaned Level0 first then Level1 which is the opposite of what VS does). The MSBuild team, while copying the internal MSBuild model from VS, obviously forgot to copy the way VS handles the level info.

mandag 29. desember 2008

MSbuild of VS solution under target clean is just plain wrong

One of our solutions has been bothering us for a long time so I finally decided to make a simple demo of the problem.

In my demo solution I have three library type C# projects Level0, Level1 and Level2. Adding and removing a (project) reference from Level1 to Level0 and building with both default and clean targets using MSBuild illustrates the problem. Beneath is the ouput of the clean build without the reference in place:

C:\Test\BuildDependencies>msbuild C:\Test\BuildDependencies\BuildDependencies.sln /t:clean
Microsoft (R) Build Engine Version 3.5.30729.1[Microsoft .NET Framework, Version 2.0.50727.3053]Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 12/29/2008 4:01:39 PM.Project "C:\Test\BuildDependencies\BuildDependencies.sln" on node 0 (clean target(s)). Building solution configuration "DebugAny CPU".Project "C:\Test\BuildDependencies\BuildDependencies.sln" (1) is building "C:\Test\BuildDependencies\Level0\Level0.csproj" (2) on node 0 (Clean target(s)). Deleting file "C:\Test\BuildDependencies\Level0\bin\Debug\Level0.dll". Deleting file "C:\Test\BuildDependencies\Level0\bin\Debug\Level0.pdb". Deleting file "C:\Test\BuildDependencies\Level0\obj\Debug\Level0.dll". Deleting file "C:\Test\BuildDependencies\Level0\obj\Debug\Level0.pdb".EntityClean: Successfully cleaned the output for 0 EDMX files.Done Building Project "C:\Test\BuildDependencies\Level0\Level0.csproj" (Clean target(s)).
Project "C:\Test\BuildDependencies\BuildDependencies.sln" (1) is building "C:\Test\BuildDependencies\Level1\Level1.csproj" (3) on node 0 (Clean target(s)). Deleting file "C:\Test\BuildDependencies\Level1\bin\Debug\Level1.dll". Deleting file "C:\Test\BuildDependencies\Level1\bin\Debug\Level1.pdb". Deleting file "C:\Test\BuildDependencies\Level1\bin\Debug\Level1.tlb". Deleting file "C:\Test\BuildDependencies\Level1\obj\Debug\Level1.dll". Deleting file "C:\Test\BuildDependencies\Level1\obj\Debug\Level1.pdb".EntityClean: Successfully cleaned the output for 0 EDMX files.Done Building Project "C:\Test\BuildDependencies\Level1\Level1.csproj" (Clean target(s)).
Project "C:\Test\BuildDependencies\BuildDependencies.sln" (1) is building "C:\Test\BuildDependencies\Level2\Level2.csproj" (4) on node 0 (Clean target(s)). Deleting file "C:\Test\BuildDependencies\Level2\bin\Debug\Level2.dll". Deleting file "C:\Test\BuildDependencies\Level2\bin\Debug\Level2.pdb". Deleting file "C:\Test\BuildDependencies\Level2\obj\Debug\Level2.dll". Deleting file "C:\Test\BuildDependencies\Level2\obj\Debug\Level2.pdb".EntityClean: Successfully cleaned the output for 0 EDMX files.Done Building Project "C:\Test\BuildDependencies\Level2\Level2.csproj" (Clean target(s)).
Done Building Project "C:\Test\BuildDependencies\BuildDependencies.sln" (clean target(s)).
Build succeeded. 0 Warning(s) 0 Error(s)


Here is the output with the reference (Level1 -> Level0) in place:

C:\Test\BuildDependencies>msbuild C:\Test\BuildDependencies\BuildDependencies.sln /t:clean
Microsoft (R) Build Engine Version 3.5.30729.1[Microsoft .NET Framework, Version 2.0.50727.3053]Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 12/29/2008 4:02:14 PM.Project "C:\Test\BuildDependencies\BuildDependencies.sln" on node 0 (clean target(s)). Building solution configuration "DebugAny CPU".Project "C:\Test\BuildDependencies\BuildDependencies.sln" (1) is building "C:\Test\BuildDependencies\Level0\Level0.csproj" (2) on node 0 (Clean target(s)). Deleting file "C:\Test\BuildDependencies\Level0\bin\Debug\Level0.dll". Deleting file "C:\Test\BuildDependencies\Level0\bin\Debug\Level0.pdb". Deleting file "C:\Test\BuildDependencies\Level0\obj\Debug\Level0.dll". Deleting file "C:\Test\BuildDependencies\Level0\obj\Debug\Level0.pdb".EntityClean: Successfully cleaned the output for 0 EDMX files.Done Building Project "C:\Test\BuildDependencies\Level0\Level0.csproj" (Clean target(s)).
Project "C:\Test\BuildDependencies\BuildDependencies.sln" (1) is building "C:\Test\BuildDependencies\Level2\Level2.csproj" (3) on node 0 (Clean target(s)). Deleting file "C:\Test\BuildDependencies\Level2\bin\Debug\Level2.dll". Deleting file "C:\Test\BuildDependencies\Level2\bin\Debug\Level2.pdb". Deleting file "C:\Test\BuildDependencies\Level2\obj\Debug\Level2.dll". Deleting file "C:\Test\BuildDependencies\Level2\obj\Debug\Level2.pdb".EntityClean: Successfully cleaned the output for 0 EDMX files.Done Building Project "C:\Test\BuildDependencies\Level2\Level2.csproj" (Clean target(s)).
Project "C:\Test\BuildDependencies\BuildDependencies.sln" (1) is building "C:\Test\BuildDependencies\Level1\Level1.csproj" (4) on node 0 (Clean target(s)). Deleting file "C:\Test\BuildDependencies\Level1\bin\Debug\Level1.dll". Deleting file "C:\Test\BuildDependencies\Level1\bin\Debug\Level1.pdb". Deleting file "C:\Test\BuildDependencies\Level1\bin\Debug\Level1.tlb". Deleting file "C:\Test\BuildDependencies\Level1\bin\Debug\Level0.dll". Deleting file "C:\Test\BuildDependencies\Level1\bin\Debug\Level0.pdb". Deleting file "C:\Test\BuildDependencies\Level1\obj\Debug\ResolveAssemblyReference.cache". Deleting file "C:\Test\BuildDependencies\Level1\obj\Debug\Level1.dll". Deleting file "C:\Test\BuildDependencies\Level1\obj\Debug\Level1.pdb".EntityClean: Successfully cleaned the output for 0 EDMX files.Done Building Project "C:\Test\BuildDependencies\Level1\Level1.csproj" (Clean target(s)).
Done Building Project "C:\Test\BuildDependencies\BuildDependencies.sln" (clean target(s)).

Now, the point is that allthough adding the reference alters the build order MSBuild does not build the clean targets in the correct order.

If you don't beleive me have a look at the .sln.cache that gets generated (if you use MSBuild V3 and VS2008). Compare the Clean and the Build targets and you will see that the build order is the same (BuildLevel0 is done before BuildLevel1 etc.).

Cleaning a referer after the referee (is that the right term?) will fail in some cases. Specifically it will fail if you need the refered assembly to clean the current assembly.

When do you need the referred assembly to clean the current one? Well our build breaks during clean with the "MSB3395: Cannot unregister assembly" error. It seems our referring assembly needs some type in the referred assembly to properly unregister. I am currently investigating why this is the case but the result doesn't change the fact that MSBuild has an issue here.

It's obvious if you think about it. If you have access to dependency information you should always clean in the opposite order of the way you normally build. Am I the only one getting this?!? Shouldn't this be obvious to the guys in redmond too?!?

tirsdag 16. desember 2008

Good overview on the motivations behind choice of Team Build structure

http://blog.nwcadence.com/2007/11/12/how-many-team-build-types-should-i-have-for-one-solution/

AdditionalReferencePaths can/will screw up your Team Build

Just spent several days pondering over a Team Build that only builds the first time after a thorough clean of the build directory. Prelimenary conclusion is as follows:

It seems like the AdditionalReferencePaths option is given a higher priority than the framework itself. This leads to resolving things like System.dll from the output path instead of from the relevant target framework(!!).

The reason I started thinking this is that the it was obvious from the build log that our output path was beeing preferred for stuff like System.dll, System.Data.dll etc. We are deliberately not using CopyLocal and simultaneously have set all our $(Output) to one directory. All file references are picked up from this folder.

I tested out this conclusion by simply removing the one AdditionalReferencePaths inclusion we had and it did the trick.

Now, this preference of AdditionalReferencePaths over target framework path cannot be a good descicion from MS can it?

tirsdag 9. desember 2008

Bug in how LINQ2SQL tracks changes?

Just realized (through a reported bug in my code) that you have to be careful with the Attach to DataContext pattern (Note to self. Remember to blog on this).

It seems that even though attaching a newly created POCO to your DataContext will start change tracking, setting properties to the "type default" value doesn't add an entry to the change log for the DataContext.

I will try to verify this partly by taking alook under the hood of LINQ2SQL (thanks Lutz ;)) and partly by working around this in my code. Should this be considered a bug in LINQ2SQL? I for one am open for debate.

Will be back with more on this.

onsdag 26. november 2008

Some fiddle bits on .NET 64 bit

While fiddling with a totally different problem I came over this little thing on enabling 64Bit .NET in various ways. It made my Windows Server 2003 R2 64Bit Sql Server 2005 64Bit combo much more happy (for now).

http://www.expta.com/2007/11/installing-or-switching-aspnet-versions.html

MartinM