We use Wix to build installers at my work. I've blogged about this before.

Wix comes with custom actions to create IIS App Pools and Virtual Directories. Up until today, my wix scripts all WebVirtualDirs and WebAppPools in the same component:

	<Component Id='WebApp_WithAppPool' 
		   Guid='$(var.IIsWithAppPoolSettingsComponentId)'>
        	<Condition>Not IISMAJORVERSION="#5"</Condition>
                <WebAppPool Id='MyAppPool'
                            Name='$(var.AppPool)' />
                <WebVirtualDir Id='MyVDirWithAppPool'
                               Alias='IMR/$(var.InstallDirectory)'
                               Directory='INSTALLDIR'
                               WebSite='Default'
                               DirProperties='AppDirProps'>
                    <WebApplication Id="MyAppWithAppPool" 
				    Name='[ProductName]' 
				    WebAppPool='MyAppPool'>

We recently changed the security model of this application to use a service account, but the above installer would uninstall the app pool when the application was uninstalled. When they went to install an upgraded version they would have to find someone that knew the password for the service account to enter it in the app pool settings after installing.

A little searching led me to this mailing list thread, where they recommend adding a Permanent='yes' attribute (which I didn't realize existed.)

This worked, but then my vdir doesn't get uninstalled, so I just created a new component for the app pool, made it permanent, and voila:

  • When installing
    • If the app pool doesn't exist it's created
    • If it exists we leave it alone but still put the app in it.
  • When uninstalling
    • The vdir is deleted, but the app pool is left alone.
	<Component Id="WebApp_AppPool"
		   Guid="$(var.IIsAppPoolComponentId)"
		   Permanent="yes">
       		<Condition>Not IISMAJORVERSION="#5"</Condition>
                <WebAppPool Id='MyAppPool'
                            Name='$(var.AppPool)' />
	</Component>
	<Component Id='WebApp_WithAppPool' 
		   Guid='$(var.IIsWithAppPoolSettingsComponentId)'>
        	<Condition>Not IISMAJORVERSION="#5"</Condition>
                <WebVirtualDir Id='MyVDirWithAppPool'
                               Alias='IMR/$(var.InstallDirectory)'
                               Directory='INSTALLDIR'
                               WebSite='Default'
                               DirProperties='AppDirProps'>
                    <WebApplication Id="MyAppWithAppPool" 
				    Name='[ProductName]' 
				    WebAppPool='MyAppPool'>

 

It actually took me a little while to find out about Permanent='yes', hence this blog post.


 
Categories: installer | tool | wix

September 18, 2007
@ 07:31 AM

My friend Michael shared a great tool link the other day and I learned they have both a portableapps format and a U3 format portable version. This is a great alternative to putty, which is what I used to use (until yesterday) for ssh and FileZilla which I used to use for sftp. Thanks Michael!


 
Categories: tool

After reading this, I am inspired to point out my favorite fire fox trick: In firefox, you can assign keywords to bookmarks. So, for example, I have a bookmark for gmail, I assign the keyword "m". In the address bar, I type "m" and get gmail. "r" = google reader, "s" = safari books online, etc.

I only have about 10 bookmarks in the browser, and in fact, the only reason I have those is because of this shortcut feature. For all other bookmarks I just use del.icio.us.


 
Categories: tool

October 30, 2006
@ 09:35 AM

This weekend, at Code Camp Seattle 2.0, Peter Provost and Brad Wilson presented on Worlds of Warcraft, and how you could use a scripting language, LUA, built into it to change the UI. I don't play WoW, but though it would be an interesting change (it was!)

LUA seemed like an interesting language. I can think opf a number of times over the years, where I had thought that it would be nice to expose scripting extensibility points in my applications. I made a mental note to explore this further.

This morning, while trouble shooting an unrelated problem, I downloaded the latest Wireshark (used to be called Ethereal) and noticed the installer had an option to install LUA (experimental.)

Intersting how seeing something in one place makes you more prone to notice it in others. 


 
Categories: scripting | tool

October 23, 2006
@ 12:57 PM

Today I needed to svn mv a bunch of generated code files. I quickly popped open a Power Shell window and built this up incrementally (in about 2 minutes).

We switched from generating derived classes to generating base classes, then deriving from them (I call this "the sandwich model.") I wanted the history to show the flow from what was our derived classes into what are now base classes.

Anyway, fuzzy mass renaming seems like a major strength of power shell for me lately:

ls *.cs
| where {$_.Name -cnotlike '*WorkItem*' -and $_.Name -cnotlike '*Base*'}
|% {$baseName = [System.IO.Path]::GetFileNameWithoutExtension($_);
$oldName = $baseName + '.cs';
$newName = $baseName + 'Base.cs';
svn mv $oldName $newName;}

 
Categories: scripting | tool

This isn't mentioned in the Windows Live Writer Plugins over on the side of my weblog (look --->), but I used it for the last post and it worked without fuss. Worth checking out. Thanks, Mike Ormond! 

Link to Mike Ormond's WebLog : Live Writer Source Code Format Plug-in


 
Categories: links | tool

October 4, 2006
@ 02:33 AM

Inspired by Roy and Andrew, I have been itching to try using MbUnit on a new project. This evening I got a chance to do that. I have a tool I use for several projects, and I wanted to add a bunch of features to it, so I seized the day.

It's been at least a year since I used MbUnit for a real project. In that time, my unit testing style has changed a lot.

I'd say the biggest change for me came after watching Brad Wilson write unit tests in front of an audience at Seattle Code Camp last year (link broken at time of writing). The speed and rhythm he had going really left an impression, and changed my style. It caused a bunch of things to gel for me. Watching a pro do Unit Testing is a great thing. (Also check out John-Paul Boodhoo in the DNR TV Videos he and Carl made.)

Since then, I often write a method, and maybe the first thing I want to do is write a guard clause. I write a test to feed in the base value, then write the guard clause. I might have a series of bad scenarios, then finally, the normal flow, which is often my last unit test before deciding I am done (for now.)

So I end up with unit tests that look like this (maybe with ExpectedExceptions, but usually just verifying a return value or something):

 

[Test,ExpectedException] public void EdgeCase() {}

[Test,ExpectedException] public void EdgeCase() {}

[Test,ExpectedException] public void EdgeCase() {}

[Test] public void MainFlow() {}

Everything is very explicit, with a "statement" for every part of the contract the method implements...kind of like a verbose legal contract.

So the first thing I notice writing tests like this in mbunit is that these collapse down to:

 

[RowTest, ExpectedException, Row, Row, Row, ...] public void EdgeCase() {}

[RowTest, Row, Row, Row, ...] public void MainFlow() {}

It's about 30% faster for me to write the RowTest version, even though I have a CodeRush template for simple unit tests and expected exception tests. RowTests are just plain more concise. More like notesy instructions to your coding buddy than formal legal contract.

The only thing I don't like about this is the way the code looks formatted. Readability is very big for me, and I like collapsing my tests up so they look this this:

 

[Test] public void SomeMethod_ShouldDoSomething() ...

[Test] public void SomeMethod_ShouldDoSomethingElse()...

[Test] public void SomeMethod_ShouldntDoSomethingBad()...

All the Rows end up pushing the method name out of the right margin, or force me to put in line breaks.

But that's just being nitpicky. I'm sure I'll figure something out.

 

Currently listening to Party For Your Right To Fight by Public Enemy from the album It Takes A Nation Of Millions To Hold Us Back


 
Categories: tdd | tool

September 25, 2006
@ 05:26 AM

Exciting! For Me: Now I don't need to use my own SQL Everywhere dialect, and I can use NHibernate with legacy systems that require me to use stored procs. I like built-in generics support too - remembering to add Ayende's NHibernate.Generics was just one more thing to remember. Can't wait till this is done with beta.

Source: NHibernate 1.2 Beta1 Released!
Originally published on Mon, 25 Sep 2006 12:32:06 GMT


 
Categories: database | library | tool

Roy Osherove (ISerializable) has a post discussing using MbUnit vs. NUnit. I was a big fan of MbUnit when I first discovered it. The problem I found, almost exactly as Roy describes it, is that nobody has heard of it, and just getting people to use NUnit is pain enough.

The thing that NUnit really has going for it is that it's so simple. You can literally explain how to use it in a minute. It's only after a few days of serious use that people start to ask questions that MbUnit answers.

If I was fully in control of a project I was on, or I was developing something by myself, I would use MbUnit. In all other situations, I try to avoid the "yet-another-weird-library-from-Chris" syndrome and stick with NUnit.

This makes me sad, because I believe that you should always use the best tool for the job, not settle on something just because you are too lazy to explain something you know is superior. 

Why are people so afraid of new tools?

How can you improve if you never try anything better?

Link to ISerializable - Roy Osherove's Blog : MbUnit vs. NUnit Vs. Team System Unit Testing - Choosing a unit test framework

Currently listening to Tracy by Mogwai from the album Young Team


 
Categories: tdd | tool

September 24, 2006
@ 10:52 PM

It's been a while since I tried the latest RC/Beta build of TestDriven.NET, one of my favorite tools ever. I read Jamie Cansdale's (the developer) weblog, so am aware of the features constantly being added, but I was still using a much older version, and hadn't tried any of the new features.

Since TestDriven.NET has become an essential part of my development process, I decided I really needed to buy a real license. A check I was waiting on just cleared, so I bought it this evening.

It's extremely pleasant to see a bunch of features now in TestDriven.NET that I had always wanted:

  • Repeat Last Test Run: == New Hot Key. How many times I have jumped down into some code for a failing test, then spent 20 seconds finding my way back from some change (why hadn't I dropped a code rush marker! doh!). This rocks and is a tremendous time saver.
  • Unhandled Exceptions don't end the test process. This is the thing that reminded me to download it. I have some code that calls an unmanaged C++ library that one of my tests was crashing, sort of on purpose. Now I will get better information about this than the usual "existing connection broken."
  • 64-bit Support: I didn't know this was missing until after installing 64-bit XP last year, just before a presentation (doh!)
  • Can Use MSBee Targets to Build: Awesome. We still have several projects that we need to compile in 1.1 and we often find one or two tests in a big suite that fail mysteriously on the build server, after being build for 1.1. Not to mention it will be easier to verify the 1.1 build works without running MSBuild manually.

Awesome stuff!

Link to TestDriven.NET > Home


 
Categories: tdd | tool

September 20, 2006
@ 12:47 PM

Oops! I thought this post meant WiX was going to be _in_ VS 200next, but apparently I was wrong: 

In my previous blog entry, I mentioned that Visual Studio was adopting the WiX toolset. Despite the fact that Derek was leaving, that post generated a bit of excitement. I even had a couple people contact me directly about the prospect that Visual Studio would be shipping WiX v3.

Unfortunately, when I said "the Visual Studio team approached the core WiX development team about replacing their custom MSI build system with the WiX toolset" I meant that Visual Studio would be using WiX to create the MSI file for Visual Studio. As far as I know, there are currently no plans to replace the "Setup Projects" (.vdproj) in Orcas with the WiX toolset. If they are, Visual Studio certainly haven't told me about it.

However, since a few people found the idea of replacing the .vdproj with WiX v3 so enticing, I'd like to do an informal poll. Please, leave a comment below if you have an opinion on whether Visual Studio should replace the current "Setup Projects" (.vdproj) with WiX v3. I'll be sure to point the guys I know on the Visual Studio team to the results.

Already lots of comments to that on Rob's weblog. I am actually kind of curious why they haven't done this already. I've never met a developer that was attached to vdproj's.

Source: WiX in Visual Studio
Originally published on Mon, 18 Sep 2006 23:40:17 GMT


 
Categories: tool

September 16, 2006
@ 08:39 AM

In an otherwise kind of sad post about an important WiX developer leaving Microsoft, Rob Menshing mentioned that the Visual Studio team will replace their custom MSI building thing (whatever builds vdproj's) with WiX.  

Also in 2005, the Visual Studio team approached the core WiX development team about replacing their custom MSI build system with the WiX toolset. Derek was at every meeting with me. Together we answered their questions, discussed timelines and feature requests and ultimately convinced the Visual Studio team to bet on WiX v3 for their next release of Visual Studio. Without Derek's experiences integrating WiX into Office, I'm not sure we could have convinced Visual Studio to pick up the WiX toolset.

Then in 2006, Derek did even more of the work to get the SQL Server team moved to the WiX v3 toolset. Thanks to Derek's efforts, I expect by late 2007 the standard MSI creation technology at Microsoft will be the WiX v3 toolset. So, I hope you can see now why I considered handing over leadership responsibility of the WiX toolset to Derek Cicerone. He had certainly earned it, had he wanted it...

It sucks that WiX lost an important contributor, but it sure is about time Microsoft replaced vdproj's. WiX is a really awesome and powerful tool.

Source: Bittersweet change, Derek Cicerone leaves WiX.
Originally published on Sat, 16 Sep 2006 02:13:02 GMT


 
Categories: tool

September 16, 2006
@ 07:36 AM

My kind of tool - a tool for keeping your tools up to date. 

Source: Interesting Finds: September 15, 2006
Originally published on Fri, 15 Sep 2006 19:59:00 GMT


 
Categories: tool

Last week I saw this useful set of sample scripts for admin tasks. This morning I finally got to review it.

I like this kind of stuff because I rarely have time to learn admin skillz, yet, as a developer, I need to use them for trouble-shooting and keeping our development environment in order.

To bad these weren't in PSH.

Source: STUFF YOU CAN USE!! Finger Saving Good – No Touch Administration
Originally published on Fri, 08 Sep 2006 17:37:00 GMT


 
Categories: tool | admin | scripting

September 13, 2006
@ 04:51 AM

I had to read this post by Secret Geek about a cool library called "File Helpers" - the title itself hits a sore point for me. I am guilty of rolling my own CSV Parser. I waffle between, "I should just use the Jet Text Driver - they worked through all the CSV issues long ago", and "Gee...the JET text driver doesn't even do [insert some special edge case] right? Well, I guess I'm not using that!"

The JET CSV driver shows it's age in other ways too. I can't imagine it will be supported much longer. Why doesn't .NET have better CSV support built in? It's disturbing the number of times I've had to deal with CSV files since moving to .NET. I'm getting creeped out just thinking about it.

The last time I had to deal with CSV files (2 months ago), I found a really nice regular expression that looked pretty bulletproof. I wrote about 40 or 50 unit tests for all the edge cases I could think of in about 2 hours, and felt pretty good about it.

Too bad I didn't know about File Helpers before. I now feel the urge to go and change a whole bunch of code. Thanks, secretGeek!

Source: Stop Rolling Your Own CSV Parser!
Originally published on Wed, 13 Sep 2006 01:16:35 GMT


 
Categories: tool | library

September 12, 2006
@ 02:21 PM

I took some time off to watch this morning. It's sooo awesome to see Scott Hanselman use windows at 1.8x speed. I learned about 5 things about tools I thought I knew everything about. Pretty cool! 

Source: DNRTV - Sysinternals Tools
Originally published on Mon, 11 Sep 2006 02:16:38 GMT


 
Categories: links | tool | 411

September 11, 2006
@ 01:54 PM

I just recently started using my own build of Castle.*, built with PDBs and not strong named, so I can step into the source code and understand better how it works.

I find it interesting that before I had PDBs, I could Go To Definition at design time and see the public interface of any Castle.* (or any other really) type - one of my favorite new features in VS2005.

However, now that I have PDBs, I sometimes start debugging as a short cut to go see the source code - the PDBs know where the source code is, but G To Definition doesn't.


 
Categories: bs | tool

In my last post, I tried pasting some images into the body of the post, fully expecting it not to work, and to have to cut over and FTP the images up.

When I went to post, it whined, then asked me if I wanted to set up an ftp account for posting images. I did. I tried to post again, and hello, there are my images.

Windows Live Writer rocks!


 
Categories: tool

I always kind of wondered how this checkbox in task manager works:

Today, while checking to see if I left Image File Execution Options\Debugger on for some program that is broken on my machine, I noticed this:

Now I know.


 
Categories: tool | debugging

...and finally, this entry is via the RSS Bandit plugin (mentioned below) and Windows Live Writer. It was a little hard to get it unpacked - I had trouble decompressing the binary distribution, but the source distribution worked fine and even had binaries in it - but other than that, it was totally simple.

This is going to make it really easy to post things really quickly. I hope the image below shows up - that has always been one of the hassles with posting in the builtin editor in dasBlog. [fingers crossed] 

I just got an email from J.J. Allaire pointing me to the blog post on the Windows Live Writer plugins blog entitled Windows Live Writer Blog This for RSS Bandit which states

And now comes Blog This for RSS Bandit.

RSS Bandit is a popular feed reader (what are feeds?) which by default can Blog This with w.bloggar (a desktop blogging client) and post to del.icio.us.

1

Installation is simple albeit manual. Extract the file, highlight the files, then copy and paste them into the RSS Bandit plugins folder: not into the Windows Live Writer plugin folder.

Start RSS Bandit. See something you would like to write about? Right-click on the headline and choose BlogThis using Windows Live Writer.

Windows Live Writer launches with the Select Destination Weblog window where you select which blog to post to. Once selected it takes a moment or two and then there is your screen with the text from the feed’s post:

I just wrote about wanting to write this plugin a few hours ago. I'll probably still write one on my own and replace the w.bloggar plugin in the default install of RSS Bandit with a Windows Live Writer plugin. Perhaps even an installer for existing users who don't want to wait until the next version of RSS Bandit to get this feature? 

Source: Windows Live Writer & RSS Bandit Together at Last
Originally published on Fri, 08 Sep 2006 00:57:08 GMT


 
Categories: tool

September 8, 2006
@ 05:03 AM

...and a post from the "blog this in live writer" firefox plugin. Worked great.

Check out these free Borland IDEs. I am thinking about learning Delphi.NET just for fun - I've always wanted to learn Delphi since working with a bunch of Delphi programmers at NEC back in the day. 

Link to Turbo Downloads


 
Categories: tool

September 8, 2006
@ 05:00 AM

This is my first test post from Live Writer. So far so good.


 
Categories: tool