<feed version="0.3" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://purl.org/atom/ns#" xml:lang="en"><title>Waaargh.NET</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/default.aspx" /><tagline type="text/html">Programming makes me wanna scream. In a good way :)</tagline><id>http://dotnetjunkies.com/WebLog/appeng/default.aspx</id><author><url>http://dotnetjunkies.com/WebLog/appeng/default.aspx</url></author><generator url="http://communityserver.org" version="1.0.1.50214">Community Server</generator><modified>2004-10-14T07:22:00Z</modified><entry><title>Silverlight Alpha 1.1 TextBox</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2007/05/07/silverlight_1_1_alpha_textbox_sample.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:234044</id><created>2007-05-07T03:42:00Z</created><content type="text/html" mode="escaped">I managed to extend the SilverLightControls samples that are part of the SDK to make a TextBox.&lt;br&gt;&lt;br&gt;At the moment it's pretty barebones. It has a moving cursor (or is it a caret, I never know), you click on it to focus, you can type text into it, you can get/set text with the Text property and that's about it.&lt;br&gt;&lt;br&gt;It still needs:&lt;br&gt;- position the cursor&lt;br&gt;- resizing&lt;br&gt;- move the start of the text to the left if it becomes too long for the box&lt;br&gt;- selecting text&lt;br&gt;- enable Ctrl-V and Ctrl-C etc...&lt;br&gt;- enable text styles&lt;br&gt;- ...&lt;br&gt;&lt;br&gt;How to make it work:&lt;br&gt;1. include the files in the SilverLightControls project in the SDK (freely downloadable from silverlight.net)
&lt;br&gt;2. make sure the xaml files are 'embedded resources'
&lt;br&gt;3. replace Page.xaml and Page.xaml.cs in the TestApp project (also in the SDK) with the ones below
&lt;br&gt;4. rebuild TestApp and run
&lt;br&gt;5. click on the textboxes to type
&lt;br&gt;6. click on submit

&lt;br&gt;&lt;br&gt;&lt;a href="http://users.pandora.be/stombeur/code/SilverLight1_1Alpha_TextBoxSample.zip"&gt;The code for the controls&lt;/a&gt;

&lt;br&gt;&lt;br&gt;&lt;a href="http://users.pandora.be/stombeur/code/Page.xaml"&gt;Replacement Page.xaml&lt;/a&gt;

&lt;br&gt;&lt;br&gt;&lt;a href="http://users.pandora.be/stombeur/code/Page.xaml.cs"&gt;Replacement Page.xaml.cs&lt;/a&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=234044" width="1" height="1"&gt;</content><slash:comments>0</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=234044</wfw:commentRss></entry><entry><title>Indirect package configuration in Sql Server Integration Services (SSIS)</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2006/05/30/indirectconfigpackagessis.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:139281</id><created>2006-05-30T06:05:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;FONT&gt;Today I was struggling with package configurations in SSIS. I wanted to use a Sql Server store to configure an SSIS package, but I needed the configuration filter to be dynamic. A colleague pointed me in the right direction: use the indirect 'environment variable' technique in the Configuration Package manager.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;In SSIS it is possible to store configuration values in an Xml&amp;nbsp;file, environment variable or Sql Server table. Every time your package is executed, the values are loaded first (e.g. into your user-variables). With the SqlServer store, it is also possible to use the same table in a database to store configuration data for more than one package by using a Configuration Filter to select the right records. It's a bit counter-intuitive in the UI for creating package configurations though, so I thought I'd post a short howto.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;1. Create a (direct) Sql Server package configuration from the SSIS &amp;gt; Package Configurations... menu. &lt;BR&gt;2. 'Add' a configuration, and select Sql Server. &lt;BR&gt;3. Select a database and create a table with the 'New' button. &lt;BR&gt;4. Fill in a key for the Configuration Filter value (it doesn't matter what). &lt;BR&gt;5. Now click 'Next' and select the variables you want to store in the configuration. (Note: notice how you can click the '+' sign in front of a user variable to deselect stuff that you don't need. In most cases you just need the value of the variable and not wether it was changed or not...). &lt;BR&gt;6. Finish and you have a new configuration. Yay! &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;IMG src="http://users.telenet.be/stombeur/images/directsqlconfig.PNG"&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;And now for the neat trick: create another configuration. &lt;BR&gt;7. Choose Sql Server this time as well, but select the 'Configuration location is stored in an environment variable' option. &lt;BR&gt;8. Fill in a name for the environment variable and click Next till you finish.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;IMG src="http://users.telenet.be/stombeur/images/indirectsqlconfig.PNG"&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;On the over view screen you now have 2 package configurations. A (direct) Sql Server config and an indirect sql server config.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;Next you need to create an environment variable with the right content to point SSIS to your configuration package. (Right-click on 'My Computer' &amp;gt; Properties &amp;gt; Advanced &amp;gt; Environment Variables). Now take a good look at the package configurations list in the screen you had open before. In the entry for the (direct) SqlServer config, there is a column 'Configuration String'. This is the value you need to use for your environment variable. It is something like "SSIS_CONNECTION_MANAGER_NAME";"TABLE_NAME";"CONFIGURATION_FILTER".&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;IMG src="http://users.telenet.be/stombeur/images/configoverview.PNG"&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;By changing the CONFIGURATION_FILTER part of the environment variable's value, you can now point different packages (or different instances of the same package) to different configuration values.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;The obvious next step is to run DTexec.exe and change the value of the environment variable every time.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;Why oh why do you need to create the direct one first, you may ask? Well, this way it will create the rows for you in the database for all the variables you select, and you can simply copy them with a new ConfigurationFilter value. If you create an indirect one from the start, you need to create the table and add the rows yourself. It helps to use the direct way until your set of variables is pretty stable, that way you benefit from the automatic adding of the variables to the table.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;Thanks for your help, Robert!&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=139281" width="1" height="1"&gt;</content><slash:comments>0</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=139281</wfw:commentRss></entry><entry><title>Enable Intellisense for NAnt and Wix files in VS2005 Beta1</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2005/03/15/60381.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:60381</id><created>2005-03-15T14:20:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;FONT&gt;&lt;EM&gt;Edit: This still works for VS2005 Beta2&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Since Beta 2 is still a month off or so, I think this could still be relevant :-)&lt;/P&gt;
&lt;P&gt;&lt;A href="http://dallas.sark.com/SarkBlog/cboland/archive/2004/09/13/381.aspx"&gt;This &lt;/A&gt;blog tells you how to enable intellisense for NAnt .build files in VS2003.&lt;BR&gt;&lt;A href="http://weblogs.asp.net/sweinstein/archive/2004/08/31/223461.aspx"&gt;This &lt;/A&gt;blog does the same for Wix .wxs files.&lt;/P&gt;
&lt;P&gt;Both should be slightly altered to work with VS2005 beta1.&lt;BR&gt;&lt;BR&gt;1) copy the schema files (.xsd) to the following folder: C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas&lt;BR&gt;&lt;BR&gt;2) the registry key with which Wix (.wxs) and NAnt (.build) files can be registered as being xml is now:&lt;BR&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Editors\{412B8852-4F21-413B-9B47-0C9751D3EBFB}\Extensions]"wxs"=dword:00000029 &lt;BR&gt;(replace the "wxs" by "build" for NAnt)&lt;BR&gt;Note the subtle difference: dword value is 0x29 and&amp;nbsp;not 0x28, which is ".htm" in vs2005b1, and the guid is different.&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=60381" width="1" height="1"&gt;</content><slash:comments>1</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=60381</wfw:commentRss></entry><entry><title>Reader-annotated edition of Neal Stephenson's "Command Line"</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2005/01/10/43278.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:43278</id><created>2005-01-10T20:52:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;FONT face=Arial size=2&gt;For those of you who don't read BoingBoing.net:&lt;BR&gt;'In the beginning was the command-line' is a really good essay that touches upon the different cultures that OS'es have become. We all feel like we belong to some sort of tribe, but ours isn't called&amp;nbsp;'The Comanches' or 'The BlackFoot', but instead it's called .NET, java, Mac, Windows, Linux, GNU, ...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Read it online (via &lt;A href="http://www.boingboing.net"&gt;BoingBoing.net&lt;/A&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;With Neal Stephenson's permission, this guy has annotated In the Beginning was the Command line and posted it online for everyone to see. I think this is a great example of how works can evolve and be improved upon. Unfortunately, In the Command Line has not been 'set free', but it's great that the author was able and willing to give permission for this development.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://home.earthlink.net/~android606/commandline/index.html"&gt;http://home.earthlink.net/~android606/commandline/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Another interesting read by Neal Stephenson is 'Mother earth, mother board', about global communication backbones in the internet-age. You can read it online here: &lt;A href="http://www.wired.com/wired/archive/4.12/ffglass.html"&gt;http://www.wired.com/wired/archive/4.12/ffglass.html&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=43278" width="1" height="1"&gt;</content><slash:comments>0</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=43278</wfw:commentRss></entry><entry><title>Virtual PC - 'NTLDR is missing' error</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2004/12/24/38813.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:38813</id><created>2004-12-24T12:01:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;I was playing around with a VPC image for windows 2003 server. I created a 'blank' image and wanted to copy this, do I wouldn't have to go through the install each time I wanted to try out some new server stuff. I copied both the config file (.vmc) and the hard disk file (.vhd) for the vpc to another location and tried to re-start this new copy. Instead of the usual bootscreen I was confronted by a "NTLDR is missing. Press any key to restart..." message. I almost freaked and switched to using&amp;nbsp;VMWare ;-)&lt;/P&gt;
&lt;P&gt;The solution to this error is simple: &lt;U&gt;instead of copying both files, just copy the hard disk file (.vhd) and create a new virtual pc configuration&lt;/U&gt; on top of this copied hard disk. The cause is probably some name or path settings in the vmc file that ar no longer in synch with its location. Creating a new vpc config is as easy as starting up the vpc console, clicking 'New' and following the wizard. (this even works after you get the error, there's nothing wrong with the hard disk file)&lt;/P&gt;

EDIT: turns out I was wrong. The VPC tried to boot from a USB stick I had left in one of the slots and didn't find a boot sector. Removing the USB stick removed the problem&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=38813" width="1" height="1"&gt;</content><slash:comments>0</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=38813</wfw:commentRss></entry><entry><title>Creating custom MSBuild tasks</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2004/12/07/35354.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:35354</id><created>2004-12-07T08:04:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;FONT face=Arial size=2&gt;Let's pick up &lt;/FONT&gt;&lt;A href="http://dotnetjunkies.com/WebLog/appeng/archive/2004/10/14/28491.aspx"&gt;&lt;FONT face=Arial size=2&gt;where we left off&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;If you go to the &lt;/FONT&gt;&lt;A href="http://channel9.msdn.com/wiki/default.aspx/MSBuild.HomePage"&gt;&lt;FONT face=Arial size=2&gt;MSBuild wiki&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;, you'll &lt;/FONT&gt;&lt;A href="http://channel9.msdn.com/wiki/default.aspx/MSBuild.FaqTasks"&gt;&lt;FONT face=Arial size=2&gt;see &lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;that the topic&amp;nbsp;&lt;!--StartFragment --&gt; "How do I write a task?" is still blank. There is an &lt;A href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/dnlong/html/msbuildpart2.asp"&gt;MSDN article&lt;/A&gt; (in a 3 part series) that explains this, so I'll start from another perspective: I have some existing NAnt tasks and I want to use these in MSBuild.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Let's start with a simple one: &lt;/FONT&gt;&lt;A href="http://nantcontrib.sourceforge.net/release/latest/help/tasks/version.html"&gt;&lt;FONT face=Arial size=2&gt;Version&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;(actually, it's a nantcontrib task, but that's the same, right?). In NAnt this task reads a version number from a file, increments it and uses it as a NAnt property.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Change the using statements&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt; NAnt.Core;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT face="Courier New" size=2&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt; NAnt.Core.Attributes;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT face="Courier New" size=2&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt; NAnt.Core.Util;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;To their MSBuild equivalents:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; Microsoft.Build.Utilities;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; Microsoft.Build.Framework;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Also, don't forget to set the namespace to something more appropriate.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Next, you should rename the task not to include the 'Task' suffix. In NAnt, the taskname you use in the buildfile is set with a custom attribute on the class &lt;FONT face="Courier New"&gt;[TaskName("name")]&lt;/FONT&gt;, but MSBuild uses the classname. The good way to do this imo, is to leave off the 'Task' suffix, as this is the way the standard MSBuild tasks are named.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You will see something like the above with the public properties exposed by the task. In both NAnt and MSBuild, you can set/get these in xml. NAnt uses the technique of marking these properties wit the &lt;FONT face="Courier New"&gt;[TaskAttribute("name")]&lt;/FONT&gt; custom attribute, and MSBuild just uses the correct name of the property. So remove the attributes on the properties.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;On some properties, in the NAnt version you will see the attribute &lt;FONT face="Courier New"&gt;[StringValidator(AllowEmpty=false)]&lt;/FONT&gt;. Replace this with the MSBuild &lt;FONT face="Courier New"&gt;[Required]&lt;/FONT&gt; attribute.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;NAnt also contains a package called "StringUtils". Unless you want to re-use this, you're going to have to remove any references to this package, e.g. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;StringUtils.ConvertEmptyToNull(&lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;becomes&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;.IsNullOrEmpty(&lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;)) ? &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt; : &lt;FONT color=#0000ff&gt;value&lt;/FONT&gt;;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Also, the BuildException class is NAnt-specific. Replace these with generic Exceptions for the time being.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Next we come to the body of the implementation. Replace the NAnt ExecuteTask() method with its MSBuild Execute() equivalent. The first difference you'll notice is that the MSBuild version returns a boolean value, true if the task succeeded, so you'll need a mechanism (combined with try/catch) that determines the outcome.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Replace the logging mechanism with the MSBuild Log class:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Courier New" size=2&gt;
&lt;P&gt;Log(Level.Info, "Build number '{0}'.", buildNumber);&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;becomes&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;Log.LogMessage(&lt;B&gt;&lt;FONT color=#008080&gt;BuildEventImportance&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;.Low, "Build number '{0}'.", _buildNumber);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The rest of the implementation is the same, the compiler will help you with any NAnt-specific things (mostly BuildExceptions).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;When you look at the code that comes with this post, you'll see that I added a method called "WriteVersionInfoFile" and that this is executed if the corresponding property is set to true in the buildfile.&amp;nbsp; This is used to create&amp;nbsp;a VersionInfo.cs file that you can use in your solution to represent the version information for the assemblies. If you want all assemblies in a solution to have the same version number, you need to remove all AssemblyVersion attributes from the AssemblyInfo.cs files, and put this information in a solution file called "VersionInfo.cs". You can then add this file as a link to all projects in the solution (not as file, because then it is copied) and it will be used to set the version number for the assemblies.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A quick recap:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;1. replace the "using" statements&lt;BR&gt;2. remove the NAnt &lt;FONT face="Courier New"&gt;[TaskXXX]&lt;/FONT&gt; attributes and name the class and its properties correctly&lt;BR&gt;3. replace the NAnt &lt;FONT face="Courier New"&gt;[StringValidator(XXX)]&lt;/FONT&gt; attributes with MSBuild or other equivalents&lt;BR&gt;4. solve the StringUtils issue (either remove it or import it)&lt;BR&gt;5. remove all references to BuildException&lt;BR&gt;6. replace the logging mechanism&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You can find the source &lt;/FONT&gt;&lt;A href="http://users.pandora.be/stombeur/code/Version.cs"&gt;&lt;FONT face=Arial size=2&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You can find the original 'VersionTask.cs' file in the nantcontrib source redistributable. I used the one from v0.84, but the 0.85RC1 version is the same.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Now for some licensing issues. I don't know if the above was entirely legal. I haven't removed the header stating that this class is 'free software under the GPL', but I've changed the name and the NAnt (c) statement. If this is in some way wrong, let me know.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#ff0000 size=2&gt;[Edit] I forgot to mention how to start using this task. See the previous post on MSBuild for instructions on how to make this task available in MSBuild buildfiles. An example of the task in action is below:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#ff0000&gt;&amp;lt;Version&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;BuildType="increment"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;RevisionType="increment"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Path="$(BuildNumberFile)"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;WriteVersionInfo="true"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;VersionInfoPath="$(VersionInfoFile)"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Output TaskParameter="BuildNumber" PropertyName="BuildNumber"/&amp;gt;&lt;BR&gt;&amp;lt;/Version&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=35354" width="1" height="1"&gt;</content><slash:comments>1</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=35354</wfw:commentRss></entry><entry><title>Custom tool to generate code from XSD in VS2005 beta 1</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2004/11/04/31021.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:31021</id><created>2004-11-04T18:55:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;Chris Sells &lt;A href="http://www.sellsbrothers.com/tools/#xsdClassesGen"&gt;posted &lt;/A&gt;a VS.NET (2002 &amp;amp; 2003) custom add-in to generate code (C#, VB and J#) from xsd quite some time ago. I stumbled upon it while looking for a way to do this in VS2005B1.&lt;/P&gt;
&lt;P&gt;With minor changes, the add-in works in VS2005B1 as well. The only&amp;nbsp;thing that stumped me for a while there is&amp;nbsp;that in VS2005B1 the generated code is created as 'dependent' upon the xsd, and is thus hidden until you enable 'Show all files' on the project and you click on the little '+' sign next to your xsd. I can't seem to remember if this happens in previous versions of VS as well.&lt;/P&gt;
&lt;P&gt;You can find the changed file &lt;A href="http://users.pandora.be/stombeur/code/XsdClassesGen.cs"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=31021" width="1" height="1"&gt;</content><slash:comments>1</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=31021</wfw:commentRss></entry><entry><title>Creating GUIDs in VS 2005 B1</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2004/10/20/29202.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:29202</id><created>2004-10-20T14:51:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;FONT face=Arial size=2&gt;In VS.NET&amp;nbsp;2003 there is an external tool called 'GuidGen' to generate GUIDs. I can't seem to find this in VS 2005 so I made my own:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT color=#000000&gt;class Program&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public const string ARG_BYTES = "/b";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public const string ARG_CSHARP = "/cs";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public const string ARG_HELP = "/?";&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringBuilder builder = new StringBuilder();&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (args.Length &amp;gt; 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (args[0])&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case ARG_BYTES:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (byte b in Guid.NewGuid().ToByteArray())&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append(b.ToString("X2"));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append(" ");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case ARG_CSHARP:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append("new byte [] { ");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (byte b in Guid.NewGuid().ToByteArray())&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append("0x");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append(b.ToString("X2"));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append(", ");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Remove(builder.Length - 2, 2);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append(" }");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case ARG_HELP:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append(string.Format("Usage: no arguments for a hexString representation, {0} for a byteArray representation, {1} for a C# byte array, {2} for this help message", ARG_BYTES, ARG_CSHARP, ARG_HELP));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; builder.Append(Guid.NewGuid().ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write(builder.ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT face=Arial&gt;At the command line type:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT face=Arial&gt;"GuidGen" for output like "ab04c0a1-ebb7-4996-914f-2a16ca9212f4"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT face=Arial&gt;"GuidGen /b" for output like: "31 34 37 18 5F 5B 2A 45 BC 8C 32 06 37 BF E9 B6"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;FONT face=Arial&gt;"GuidGen /cs" for output like "new byte [] { 0x38, 0x39, 0xC0, 0xBD, 0xCE, 0xD4, 0xEC, 0x41, 0x8C, 0x90, 0x7C, 0x96, 0x37, 0x35, 0x83, 0x1C }"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=29202" width="1" height="1"&gt;</content><slash:comments>0</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=29202</wfw:commentRss></entry><entry><title>Using the Microsoft SDC MSbuild tasks</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2004/10/14/28491.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:28491</id><created>2004-10-14T08:43:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;FONT face=Arial size=2&gt;Microsoft Research UK has released a number of 'extra' tasks for MSBuild on gotdotnet. You can find the workspace &lt;/FONT&gt;&lt;A href="http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=2cb20e79-d706-4706-9ea0-26188257ee7d"&gt;&lt;FONT face=Arial size=2&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;. These tasks include a number of common things, like file management, source control etc... You can find a complete list of tasks at Jamie Cansdale's &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/nunitaddin/"&gt;&lt;FONT face=Arial size=2&gt;NunitAddin weblog&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/nunitaddin/archive/2004/07/20/187950.aspx"&gt;&lt;FONT face=Arial size=2&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The mechanism for using custom tasks in MSBuild is with an &lt;FONT face="Courier New"&gt;&amp;lt;Import/&amp;gt;&lt;/FONT&gt; statement in your build file.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;lt;Import Project="C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\Microsoft.Sdc.Tasks"/&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;After that, you can use the tasks in your build file and msbuild will recognize them.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Of course, you still need to create the '.tasks' file that points the msbuild framework to the assembly that contains the task. This mechanism is widely used by the msbuild framework and in itself, its just a build file that uses the &lt;FONT face="Courier New"&gt;&amp;lt;UsingTask&amp;gt;&lt;/FONT&gt; task :-). It looks like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;BR&gt;&amp;lt;Project xmlns="&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;http://schemas.microsoft.com/developer/msbuild/2003&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;UsingTask AssemblyName="Microsoft.Sdc.Tasks, Version=2.0.5000.0, Culture=neutral, PublicKeyToken=e24a7ed7109b7e39" TaskName="Microsoft.Sdc.Tasks.ActiveDirectory.Group.AddUser" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;UsingTask AssemblyName="Microsoft.Sdc.Tasks, Version=2.0.5000.0, Culture=neutral, PublicKeyToken=e24a7ed7109b7e39" TaskName="Microsoft.Sdc.Tasks.ActiveDirectory.Group.Create" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;UsingTask AssemblyName="Microsoft.Sdc.Tasks, Version=2.0.5000.0, Culture=neutral, PublicKeyToken=e24a7ed7109b7e39" TaskName="Microsoft.Sdc.Tasks.ActiveDirectory.User.Create" /&amp;gt;&lt;BR&gt;...&lt;BR&gt;&amp;lt;/Project&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Next, you put this file and the assembly in the .NET framework folder (c:\windows\microsoft.net\framework\v2.0.40607).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I was getting errors running the SDC tasks because they seemed to overlap tasks already present in the basic MSBuild framework (I don't know if this was related to my desktop&amp;nbsp;install or something else). Just renaming the '.tasks' file that came with the SDC tasks to '.tasks2' and updating my import statement above made the errors go away. (spooky :))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;EM&gt;&lt;U&gt;&lt;STRONG&gt;By doing these three simple things, you can start using custom tasks in your build files:&lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;BR&gt;1. create a '.tasks' file that lists the custom tasks in an assembly&lt;BR&gt;2. copy the '.tasks' file and the assembly somewhere msbuild will find them (the framework dir is the easiest)&lt;BR&gt;3. use an &lt;FONT face="Courier New"&gt;&amp;lt;import&amp;gt;&lt;/FONT&gt; statement to reference the tasks in your build file&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;How to use the SDC tasks:&lt;BR&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;When you extract the zipfile from the gotdotnet workspace, you should look in the following folder:&lt;BR&gt;&lt;FONT face="Courier New"&gt;&amp;lt;zipfile&amp;gt;\Microsoft.Sdc.Tasks\MainTempGDN\Framework2.0&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;In this folder, you will find another zipfile, called 'GDN2.0.041008.124.zip'. Extract this zipfile and look in the following folder:&lt;BR&gt;&lt;FONT face="Courier New"&gt;&amp;lt;new zipfile&amp;gt;\Microsoft.Sdc.Tasks\MainTempGDN\Install&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;This folder contains everything you need to get started (apart from the docs :-)). Copy everything in this folder to your .NET framework folder (the v2.0.40607 one). You might experience the same 'overlap' problem I explained above, but that can be solved easy :-).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You can find a sample build file that uses some of the SDC tasks (mostly file &amp;amp; folder mgmt) &lt;A href="http://users.pandora.be/stombeur/code/GlobalBuild.proj"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Next time, I'll talk about how to create a custom task yourself,&amp;nbsp;and how to port a Nant or NantContrib task to MSBuild. I needed it because I couldn't get the source control tasks in the SDC build to work, so I ported the Nant VSS tasks.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=28491" width="1" height="1"&gt;</content><slash:comments>0</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=28491</wfw:commentRss></entry><entry><title>CruiseControl.NET and MSBuild</title><link rel="alternate" type="text/html" href="http://dotnetjunkies.com/WebLog/appeng/archive/2004/10/14/28488.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:28488</id><created>2004-10-14T07:22:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;Hi all,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;This is my first post to this blog, and I wanted to make it a more memorable one than 'this is a test' ;-)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;This blog is (among other more worldly things I hope)&amp;nbsp;going to be about automated builds. I'm currently working on a project that is in a proof-of-concept stage and is using Visual Studio 2005 Beta 1 and, by extension, the version of MSBuild that comes with it (v2.0.40607.16). In itself, that's not that unusual, but we also started out with the idea of automating builds and incorporating a number of good software practices or concepts in the build process (unit testing, static analysis, outputting reports to developers etc...).&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;If you start looking around the web for an automated build solution for .NET that can also function apart from Visual Studio, you'll probably end up with a combination of &lt;A href="http://nant.sf.net/" target=_blank&gt;NAnt &lt;/A&gt;on the one side and &lt;A href="http://ccnet.thoughtworks.com/" target=_blank&gt;CruiseControl.NET&lt;/A&gt;, &lt;A href="hhttp://hipponet.sourceforge.net/" target=_blank&gt;Hippo.NET&lt;/A&gt; or &lt;A href="http://draconet.sourceforge.net/" target=_blank&gt;Draco.NET&lt;/A&gt; on the other side. NAnt is the answer to scripting the real work behind your build process, and the other tools provide you with (a.o.) a way to schedule those builds (or execute on-demand builds) and a nice overview of past and current build results and reports.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;What you don't get is a way to combine one of these tools with MSBuild. Of course, you can do this&amp;nbsp;with NAnt by using the &amp;lt;exec&amp;gt; task to start msbuild.exe, but I wanted to cut out the middle man. &lt;EM&gt;&lt;U&gt;Note:&lt;/U&gt;&lt;/EM&gt; I do NOT want to start a religious war here and i don't consider MSBuild to be better than NAnt (or vice versa).&amp;nbsp;Let's just say I wanted to make it more challenging by veering away from the path most travelled :-).&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;So here's a short overview and a sample of my experiences with running CruiseControl.NET (ccnet for short)&amp;nbsp;with MSBuild instead of NAnt.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;First of all, ccnet uses an xml configuration file to drive the build process: ccnet.config. This file is included in every 'server' folder in your ccnet setup. Next, it has a mechanism called 'builders' that delegate the actual build process to a more specialized tool. The &amp;lt;build&amp;gt; node in the ccnet.config xml file will be used to drive the builder.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;Out of the box, a builder for NAnt (if you download the source, look for a file called NAntBuilder.cs) is included. When you look at the code, you'll see it's fairly easy to replace the arguments needed to run nant.exe with those needed to run msbuild.exe and hey-presto! - MSBuilder.cs is born.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;The first thing you'll notice in the bowels of ccnet is that&amp;nbsp;it uses a component called Exortech.Reflector to map builder properties onto xml. This means that you can decorate .NET properties with attributes that declare which xml nodes are going to be used to fill the properties with data. &lt;BR&gt;&lt;BR&gt;This code:&lt;BR&gt;[ReflectorProperty("&lt;STRONG&gt;buildArgs&lt;/STRONG&gt;", Required = false)] &lt;BR&gt;&amp;nbsp;&amp;nbsp;public string BuildArgs;&lt;BR&gt;&lt;BR&gt;Will be filled in by the &amp;lt;buildargs&amp;gt; node in the following xml:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;build type="msbuild"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;executable&amp;gt;C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\MSBuild.exe&amp;lt;/executable&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseDirectory&amp;gt;d:\temp\&amp;lt;/baseDirectory&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;lt;buildArgs&amp;gt;@mybuild.response&amp;lt;/buildArgs&amp;gt;&lt;/STRONG&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;buildFile&amp;gt;mybuild.proj&amp;lt;/buildFile&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;targetList&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;target&amp;gt;Build&amp;lt;/target&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/targetList&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;buildTimeoutSeconds&amp;gt;300&amp;lt;/buildTimeoutSeconds&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/build&amp;gt;&lt;BR&gt;&lt;BR&gt;What you basically have to do is figure out what information you need to pass onto the msbuild executable, translate this into appropriate xml, and provide properties in the 'builder' that read the xml.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;&lt;SPAN class=228433915-05102004&gt;&lt;A href="http://users.pandora.be/stombeur/code/MSBuilder.cs"&gt;Download the MSBuilder.cs file here&lt;/A&gt;.&lt;BR&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;&lt;BR&gt;The way you get ccnet to use your custom builder is either by adding it to the ccnet source code and rebuilding it, or by building it into a plugin. You can create a plugin as follows:&lt;BR&gt;- create a VS.NET 2003(!) library project&lt;BR&gt;- add your custom builder to the project&lt;BR&gt;- add the appropriate references (exortech reflector and a number of 'core' ccnet dlls)&lt;BR&gt;- name the output of the project 'ccnet.&amp;lt;insert name here&amp;gt;.plugin.dll&lt;BR&gt;- place the plugin dll in the 'server' folder of your ccnet project&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;Next, you can replace the standard &amp;lt;build&amp;gt; node in the ccnet.config file with the above 'msbuild' &amp;lt;build&amp;gt; node, write a small msbuild script ('.proj' file) and you're off.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;U&gt;In short:&lt;/U&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;1. build the custom 'builder' into a plugin dll&lt;BR&gt;2. put the plugin dll&amp;nbsp;in the ccnet server folder&lt;BR&gt;3. put the custom xml in ccnet.config&lt;BR&gt;4. point the custom xml to an appropriate msbuild script&lt;BR&gt;5. force the ccnet project to build through its website (or schedule it) and watch the magic happen :-)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;Coming up next on this blog:&lt;BR&gt;- using the Microsoft SDC MSBuild tasks to do lots of stuff (source control, file management, nunit, fxcop, ...)&lt;BR&gt;- creating custom MSBuild tasks yourself (or stealing them from NAnt) (it's not really stealing as long as you re-release them under the (L)GPL, is it ?)&lt;BR&gt;- Whatever you want to hear, as long as its about MSBuild and/or CCNET&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;SPAN class=228433915-05102004&gt;&lt;BR&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;img src="http://dotnetjunkies.com/WebLog/aggbug.aspx?PostID=28488" width="1" height="1"&gt;</content><slash:comments>3</slash:comments><wfw:commentRss>http://dotnetjunkies.com/WebLog/appeng/commentrss.aspx?PostID=28488</wfw:commentRss></entry></feed>