Windows 7 Boot to VHD

Monday, 4 April 2011

For my own reference, some useful resources about boot to VHD:

Following instructions from http://technet.microsoft.com/en-us/library/dd979534%28WS.10%29.aspx

Diskpart

create vdisk file=C:\VHD\test.vhd maximum=25000 type=expandable      select vdisk file=C:\VHD\test.vhd      attach vdisk      create partition primary      assign letter=v      format quick FS=NTFS label=VHD
exit

 

PowerShell:

PS C:\VHDs> .\Install-WindowsImage.ps1 -WIM D:\sources\install.wim

Index   Image Name
[1]     Windows 7 Home Basic
[2]     Windows 7 Home Premium
[3]     Windows 7 Professional
[4]     Windows 7 Ultimate

Done.

PS C:\VHDs> .\Install-WindowsImage.ps1 -WIM D:\sources\install.wim -Apply -Index 4 -Destination v:
Applying "Windows 7 Ultimate" to v:...
WARNING: This may take up to 15 minutes...

V:\Windows\System32\bcdboot V:\Windows
bcdedit -v
bcdedit /set {GUID} description=”Windows 7 VHD”

Useful utility BCDEdit - http://neosmart.net/downloads/software/EasyBCD/EasyBCD%202.0.2.exe

Including generated files as input for a project

Saturday, 2 April 2011

Sometimes you may have a project in your solution who’s sole purpose is to generate files that need to be referenced by a second project. If the files are fixed, then it’s just a matter of adding a link to them in the second project, but what about when you don’t know at build time how many files will be generated?

It turns out that MSBuild can handle this situation. For example, given the following solution:

image

Note that we’ve added a reference for the Generate project to the IncludeProjectOutputs project. We’ve also set ‘Copy Local’ to false as the only reason for the reference is to enforce building the projects in the right order (we don’t actually refer to the Generate assembly within the IncludeProjectOutputs code).

So that the executable output from the generator project is run, add the following to the generator project’s project file:

<Target Name="AfterBuild">
  <Message Text="After build execute $(TargetPath)" Importance="high" />
  <Exec Command="$(TargetPath)" />
</Target>

In the project that should be including the generated files, add the following:

<Target Name="IncludeGenerated" BeforeTargets="ResolveAssemblyReferences">
    <ItemGroup>
        <Content Include="$(ProjectDir)..\Generate\*.txt" >
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
    </ItemGroup>
</Target>

In this instance, we’re including all .txt files from the ..\Generate folder. Because we define the <Content /> item, they’re added as content (equivalent to the ‘Content’ build action). I haven’t tested it, but conceivably you could also add to <Compile/> or <References/> too.

The ability to add ItemGroup elements within a Target element was added in .NET 3.5. The advantage of this is that the filenames matching the pattern of the Include attribute are evaluated in the execution phase. This contrasts with normal ItemGroup elements, which are assigned values during the evaluation phase of the build. See MSBuild Items for more details.

Building this project gives the following result:

Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.431]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 2/04/2011 8:49:43 AM.
Project "C:\dev\Sandbox\IncludeProjectOutputs\IncludeProjectOutputs.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|Mixed Platforms".
Project "C:\dev\Sandbox\IncludeProjectOutputs\IncludeProjectOutputs.sln" (1) is building "C:\dev\Sandbox\IncludeProjectOutputs\IncludeProjectOutputs\IncludeProjectOutputs.csproj" (2) on node 1 (default targets).
Project "C:\dev\Sandbox\IncludeProjectOutputs\IncludeProjectOutputs\IncludeProjectOutputs.csproj" (2) is building "C:\dev\Sandbox\IncludeProjectOutputs\Generate\Generate.csproj" (3) on node 1 (default targets).
ResolveAssemblyReferences:
  A TargetFramework profile exclusion list will be generated.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
_CopyOutOfDateSourceItemsToOutputDirectory:
Skipping target "_CopyOutOfDateSourceItemsToOutputDirectory" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
  Generate -> C:\dev\Sandbox\IncludeProjectOutputs\Generate\bin\Debug\Generate.exe
AfterBuild:
  After build execute C:\dev\Sandbox\IncludeProjectOutputs\Generate\bin\Debug\Generate.exe
  C:\dev\Sandbox\IncludeProjectOutputs\Generate\bin\Debug\Generate.exe
  Generated file
Done Building Project "C:\dev\Sandbox\IncludeProjectOutputs\Generate\Generate.csproj" (default targets).
ResolveAssemblyReferences:
  A TargetFramework profile exclusion list will be generated.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
_CopyOutOfDateSourceItemsToOutputDirectory:
  Copying file from "C:\dev\Sandbox\IncludeProjectOutputs\Generate\stuff.txt" to "bin\Debug\stuff.txt".
CopyFilesToOutputDirectory:
  IncludeProjectOutputs -> C:\dev\Sandbox\IncludeProjectOutputs\IncludeProjectOutputs\bin\Debug\IncludeProjectOutputs.exe
Done Building Project "C:\dev\Sandbox\IncludeProjectOutputs\IncludeProjectOutputs\IncludeProjectOutputs.csproj" (default targets).
Done Building Project "C:\dev\Sandbox\IncludeProjectOutputs\IncludeProjectOutputs.sln" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.20

Kids' Camp Out 1983 to KCO 2011

Friday, 25 March 2011

KCO (formerly KUCA Camp Out, formerly Kid's Camp Out) is an annual overnight camping event that has been running in South Australia since 1978. It's also probably the largest event that the Uniting Church runs in Australia, as they've often had more than 2,700 kids, parents and helpers.

Groups of kids aged 7-12 years (with parents & leaders) come from all over the state. As well as camping, there's games, crafts, rides, activities, musicals, dramas, bands, and(sometimes) fireworks, in a safe, well organised setting.

My own involvement dates back to at least 1983, as you can see from this old, silverfish-eaten certificate I came across just the other day:

P1240606

A few years later when I was too old to attend as a kid, I went instead as a teenage helper. Directing traffic (sometimes in the rain), setting up, packing down, all kinds of stuff.

A bit later still, I co-led the teenage helper group for a few years until 2000. This also meant being on the organising committee for the whole event. Believe me, there's a lot of planning that goes into making sure KCO runs smoothly! One of my highlights was that I got to have my own walkie-talkie (my call-sign was 'KUCA Big Dave' if you're interested).

Probably the only year I missed during that period was 1998, which KCO kindly let me have off as it coincided with my wedding day!

While I have many fond memories, I'm quite excited because tomorrow morning I'm getting on a bus with my two oldest children (along with over 100 other kids and parent leaders from our church) and heading off to KCO 2011.

Some things will have changed in the 10 years since I last went (for one thing it's now Nuriootpa instead of West Beach – I'll leave my boardies at home this time), but I know it's going to be a fantastic weekend!

Passed 70-583

Friday, 18 February 2011

I just discovered that I've passed yet another beta exam!

So when I get around to taking the 70-513 exam, I would have then fulfilled the requirements for the certification:

Time to brush up on my WCF!

Aussie Toilets WP7 App

Tuesday, 15 February 2011

Icon for Aussie Toilets appMy second app 'Aussie Toilets' has now been published on the Windows Phone 7 marketplace. It's an app for locating the nearest public toilet, and it's free!

It uses data provided by the Australian Government's National Toilet Map website. It's a useful app to have on your phone, especially if you're out and about and need to find the nearest 'public conveniences'.


'Aussie Toilets' map screenThe app displays a map of your current location (or defaults to Australia if it isn't sure, or you've declined permission for the app to access your phone's GPS).

Once you've zoomed in to a particular location, it will begin loading the database. This may take a few seconds, as the database is quite large.

It then displays up to 5 nearest public toilets.

You can pan around the map, and use the standard 'pinch to zoom' to zoom in closer or further out.

Screengrab-hoursScreengrab-facilitiesScreengrab-addressTapping on a name will take you to a new page with more details about that facility. The data is displaying using the 'pivot' control, so you can swipe left or right to pan to each section.

Specific facilities include male/female toilets, baby change and showers. Other facilities will be added in future versions (e.g. accessible toilets etc).

The opening hours are also displayed. Some locations might be open 24 hours, others (eg. in a shopping centre) only during certain times.

These details vary for each facility and are only as accurate as the data supplied to the database by the organisations responsible for each toilet (e.g. Councils, State government agencies, transport providers, shopping centres, service stations and food outlets). The app's database in the initial release is current as of January 2011.

To install Aussie Toilets on your Windows Phone 7 device, go to http://social.zune.net/redirect?type=phoneApp&id=dcf35aa5-3829-e011-854c-00237de2db9e (Opens in Zune)

Future plans

Footnote

I took quite a while to settle on the name 'Aussie Toilets'. I'd had a few other good suggestions – things like 'Dunny Directions', 'Loo Locator' or 'Aussie Loos'. In the end I decided I'd stick with a nice obvious self-explanatory (if slightly more pedestrian) name.