But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

Version stamping Windows 8 Store App manifests in TFS build

We have for a long time used the TFSVersion custom build activity to stamp all our TFS builds with a unique version number that matches out build number. However, this only edits the AssemblyInfo.cs file. As we are now building more and more Windows 8 Store Apps we also need to edit the XML in the Package.appxmanifest files used to build the packages too. Just like a Wix MSI project it is a good idea the package version matches some aspect of the assemblies it contains. We need to automate the update of this manifest as people too often forget to increment the version, causing confusion all down the line.

Now I could have written a new TFS custom activity to do the job, or edited the existing one, but both options seemed a poor choice. We all know that custom activity writing is awkward and a pain to support going forward. So I decided to use the hooks in the 2013 generation build process template to just call a custom PowerShell script to do the job.

I added a PreBuildScript.PS1 file as a solution item to my solution.

I placed the following code in the file. It uses the TFS environment variables to get the build location and version; using these to find and edit the manifest files. The only gotcha is files on the build box are read only (it is a server workspace) so the manifest file has to be set it to allow it to be written back too.

# get the build number, we assume the format is Myproject.Main.CI_1.0.0.18290
# where the version is set using the TFSVersion custom build activity (see other posts)

$buildnum = $env:TF_BUILD_BUILDNUMBER.Split('_')[1]
# get the manifest file paths
$files = Get-ChildItem -Path $env:TF_BUILD_BUILDDIRECTORY -Filter "Package.appxmanifest" -Recurse
foreach ($filepath in $files)
{
    Write-Host "Updating the Store App Package '$filepath' to version ' $buildnum '"
   # update the identity value
  
$XMLfile=NEW-OBJECT XML
    $XMLfile.Load($filepath.Fullname)
    $XMLFile.Package.Identity.Version=$buildnum
   # set the file as read write
    Set-ItemProperty $filepath.Fullname -name IsReadOnly -value $false
    $XMLFile.save($filepath.Fullname)
}

Note that any output sent via Write-Host will only appear in the diagnostic log of TFS. If you use Write-Error (or errors are thrown) these messages will appear in the build summary, but the build will not fail, but will be marked as a partial success.

Once this file was checked in i was able to reference the file in the build template

image

The build could not be run and got my Windows 8 Store packages with the required version number

Fix for 0xc00d36b4 error when play MP4 videos on a Surface 2

Whilst in the USA last week I bought a Surface 2 tablet. Upon boot it ran around 20 updates, as you expect, but unfortunately one of these seemed to remove its ability to play MP4 videos, giving a 0xc00d36b4 error whenever you try. A bit of a pain as one of the main reasons I wanted a tablet was for watching training videos and PluralSight on the move.

After a fiddling and hunting on the web I found I was not alone, so I added my voice to the thread, and eventually an answer appeared. It seems the Nvidia Audio Enhancements seem to be the problem. I guess they got updated within the first wave of updates.

So the fix is according to the thread is as follows

  1. Go to the desktop view on your Surface
  2. Tap and hold the volume icon. 
  3. Select sounds from the pop up menu - I only had to go this far as a dialog appeared asking of I wished to disable audio enhancements (maybe it found it was corrupt)
  4. Go to the playback tab
  5. Highlight the speakers option
  6. Select properties
  7. Go to the enhancements tab
  8. Check the "Disable all enhancements" box
  9. Tap OK.

And videos should now play

Updated 2 Dec  2013 Seems you have to make this change for each audio device, this means speaker AND headphones

‘Upgrading’ my Lenovo W520 to Windows 8.1

The upgrade experience for Windows 8 Enterprise is basically a reinstall, as you lose some many desktop apps and settings. So I decided to do a clean install, my PC was in need of a repave anyway.

My PC has 3 disks, a bitlockered SSD for the OS, another bitlockered drive used for data and a non bitlockered drive I use for ISOs, downloads etc. Just to be on the safe side I removed the bitlocker encryption on my second drive, then I deleted the contents of my SSD and re-installed.

All seemed to go OK, the OS installed and then a rebooted but then hung. I then remember the problems I had had installing Windows 8 RP, if I did not have the Intel video card enabled (I usually have it disabled as I find having both it and the Nvidia confuses projectors). Once I enabled both video cards the setup completed and I was able to join the PC to the domain and associate my LiveID with the domain account.

On checking device manager I saw a few items were missing drivers

  • Microsoft basic display adapter – Just used Window update and it found the Nvidia driver
  • Base system device -  This needed the Ricoh Media Card Reader driver from the Lenovo site
  • PCI serial port -  This took a while to find but in the end I needed the Intel Management Engine Interface 7.1 and Serial Over LAN (SOL) Driver from the Lenovo site

I also found, as before, I need to use Windows update to update the soundcard drivers, the default ones  were working on the laptop, but not via the base station outputs.

I then set to installing my desktop applications. Other than Office and Visual Studio I tried to do this all with Chocolatey, thus building up a script to make this easier in the future e.g

cinst poshgit
cinst 7zip
cinst notepadplusplus
cinst WindowsLiveWriter
cinst sysinternals
cinst skype
cinst git-tf
cinst eclipse-standard-kepler

This left me with one issue, i could not work out how to setup fingerprint login. In Windows 8 there was a Biometric icon on the Control Panel, but not in Windows 8.1. So I installed the Lenovo provided fingerprint tools, as I had to do in Windows 7. This allowed me to scan a fingerprint and associate it with an account. However, then i tried to login or unlock the screen with the fingerprint I got a message that ‘cannot use a fingerprint for a domain user’. Now in previous versions of the OS there was a checkbox on the Biometric control panel that set whether fingerprints could be used for domain accounts, but as i said before this tool is not present in 8.1.

After much searching, using Google as Bing found nothing, I found that you now have to enable fingerprint usage via a Windows 8.1 settings not the control panel. Once this was done my fingerprint scanner worked as expected.

So just need to re-bitlocker my PC and we are good to go.

Update 6th Nov 2013 –  I did have to disable the Intel graphics cards again when I had done the install. When I tried to use external projectors with it enabled I got all the same problems I had seen on Win 7 and Win 8. The BIOS handling of the Nvidia and the Intel graphics in tandem just does not work with most projectors. It allows you to extend to another screen but not duplicate. Switching to just the discrete Nvidia adaptor is the only solution I have found. Remember to suspend bitlocker on your boot drive if it is enable before you make the BIOS change, else you will be typing in long unlock codes.

Changes in Skydrive access on Windows 8.1

After upgrading to Windows 8.1 on my Media Center PC I have noticed a change in SkyDrive. The ‘upgrade’ process from 8 to 8.1 is really a reinstall of the OS and reapplication of Windows 8 applications. Some Windows desktop applications are removed. In the case of my Media Center PC the only desktop app installed was Windows Desktop Skydrive that I used to sync photos from my MediaPC to the cloud. This is no longer needed as Windows 8.1 exposes the Skydrive files linked to the logged in LiveID as folders under the c:\user\[userid]\documents folder, just like Windows Desktop client used to do.

This means though the old dekstop Skydrive client has been removed my existing timer based jobs that backup files to the cloud by copying from a RAID5 box to the local Skydrive folder still work.

A word of warning here though, don’t rely on this model as you only backup. There is a lot of ransonware around at the moment and if you aren't careful an infected PC can infect your automated cloud backup too. Make your you cloud backup is versioned so you can old back to a pre-infected file and/or you have a more traditional offline backup too.

Upgrading Windows 8 Media Center to 8.1

Just done the update of my Windows 8 Media Center to 8.1. First issue was I looked in the store and could not see the update. I was looking for an ‘update’ in the top right not a huge application entry in the middle of the screen. Strange how you can miss the obvious

The download took about 30 minutes which worked in background whilst I was using Media Center. It then did a reboot,  the main install of files took about 30 minutes too. It seemed to sit at 85% for a long time, then another reboot. A few ‘preparing devices’ messages and ‘getting ready’ for a good 10 minutes, then ‘Applying PC settings', another reboot then ‘setting up a few more things’ . I then had to accept some licenses, and login with a LiveID, and eventually it started, and everything was working.

I did not time it exactly but I think about 90 minutes all told.

Update 4th Nov 2013 – I have been away on holiday and came back to find not much recorded by my Media Center. Turns out the problem was the EPG was not updating and showing ‘No data’ for about 70% of my channels (all the BBC ones plus some others). Turns out the upgrade corrupts/loses the EPG mappings. The fix is to do a full channel rescan

Lenovo W520 problems with Wifi and Windows 8

My Windows 8 based Lenovo W520 has an Intel Centrino Ultimate-N 6300 Wifi chipset, it has been giving me problems with this for a while.

The most usual problem is that if I sleep or hibernate the PC when I restart it, in a different location, there is a chance I cannot connect to Wifi networks. I can see them, get a limited connection but no IP address as DHCP fails. Sometimes using the hardware Wifi switch on the front left of the PC helps, sometimes switching into Windows 8 airplane mode and back out does, but not always. Often I need to restart the PC.

I have also had problems in Lync video calls, for example on Friday I was having all sorts of problems with a call, it was working for a few minutes then locking. When we swapped to a colleagues supposedly identical W520 all was OK.

So I think I have a problem. Time for some digging.

So I thought it was worth trying newer drivers, I had the default 15.1.x drivers provided by Windows update that are about  12 months old. I got the latest 15.6.x from Lenovo.

Also after reading around the subject I also set my Wifi adaptor to not controlled by power management (right click the network tools tray icon, open network sharing centre, change adaptor settings).

image

At first I thought this was helping, but I found if my PC screen locks due to inactivity I got a blue screen of death when I login again – with a watchdog timer error. So I switched the power save management back on and this seems to have fixed this problem.

So with the new drivers I now get a new set of behaviours.

  • The PC seems to come out of sleep OK
  • However, whilst streaming BBC IPlayer over the weekend to watch the triathlon (well done Non and Jonny) my Wifi link kept dropping and only getting a limited connection as it reconnected. This happened with two different systems, my Netgear N600 based BT ADSL and another on Virgin Cable with one of their Superhub (also Netgear based) at another house. Interestingly once I swapped from the 5Ghz to a 2.4GHz Wifi on my home N600 ADSL system I had no further problems with disconnects. Maybe a router problem here as opposed to the PC? But I did check there were no router firmware updates and no errors reported.

It then occurred to me to think what the different between my PC and my colleagues?  I had a Hyper-V virtual switch configured to use Wifi. I tried deleting this, but it appears to have no effect on the 5Ghhz problem. So maybe a read herring.

So now I think my system is more stable, but only time will tell if it is working well enough. The biggest test will be the Lync based webinar I am doing on DevOps in a couple of weeks.

 

Updated 4 Nov 2013: I have add an offline discussion about this issue, the summary of which is it appears the problem is not that of Lenovo but of Intel and/or Netgear. I seems the laptop is not listening to the instruction it gets properly or the router isn't sending it correctly and this happens on many brands of kit. In some cases the solution is to right click on the wireless connection in use and choose properties change the encryption from aes to tkip wait a few minutes and you are back on the internet, or just a restart of the wifi stack.

 

My session today at Modern Jago

Thanks  to everyone who came along to the Microsoft event today at Modern Jago. I hope you all found it useful. I got feedback from a few people that my tip on not trusting company WIFI when trying to do remote debugging of Windows RT devices was useful (or any other type of device for that matter).

I have seen too many corporate level Wifi implementation, and a surprising number of home ASDL/Wifi routers, doing isolation between WiFi clients. So each client can see the internet fine, but not any another Wifi devices. My usual solution is as I did today, use a MiFi or phone as a basic Wifi hub, they are both too dumb to try anything as complex as client isolation. Or look on your Wifi hub to check if you can disable client isolation.

Moving to an SSD on Lenovo W520

[Also see http://blogs.blackmarble.co.uk/blogs/rfennell/post/2013/01/22/More-on-HDD2-boot-problems-with-my-Crucial-M4-mSATA.aspx]

I have just reinstalled Windows 8 (again) on my Lenovo W520. This time it was because I moved to a Crucial m4 256Gb 2.5” internal SSD as my primary disk. There is a special slot for this type of drive under the keyboard, so I could also keep my 750Gb Hybrid SATA drive to be used for storing virtual machines.

I had initially planned to backup/restore my previous installation using IMAGEX as I had all I needed in my PC, but after two days of fiddling I had got nowhere, the problems being

  • The IMAGEX from my hybrid drive to an external disk (only 150Gb of data after I had moved out all my virtual PCs) took well over 10 hours. I thought this was due to using an old USB1 (maybe it was a USB2 at a push) disk caddy, but it was just as slow with a ESata. The restore from the same hardware only too an hour or so. One suggest made that I did not try was to enable compression in the image, as this would reduce the bandwidth on the disk connection, it is not as if my i& CPU could not handle the compression load.
  • When the images restored, we had to fiddle with Bcdedit to get the PC to boot
  • Eventually the Windows 8 SSD based image came up, you could open the login page with no issues but got no cursor for a long time, it it was sloooow to do anything – I have no idea why.

So in the end I gave up, and installed anew, including Visual Studio and Office it took about 30-45 minutes. There were still a couple of gotcha’s though

  1. I still had to enable the Nvidia Optumus graphics mode in BIOS, thus enabling both the Intel and Nvidia graphics sub systems. I usually only run on the discrete NVidia one as this does not get confused by projects. if you don’t enable the Intel based one then the Windows 8 install hangs after installing drivers and before the reboot that then allows you to login and choose colours etc. As soon as this stage is passed you can switch back to discrete graphics as you wish. I assume the Windows 8 media is missing some NVidia bits that it find after this first reboot or via WIndows Update.
  2. Windows 8 is still missing a couple of drivers for the Ricoh card reader and Power management, but these are both released on the http://support.lenovo.com/en_US/ site. You do have to download these manually and install them. All the other Lenovo drivers (including updated audio I have mentioned before) come down from Windows update.

So the moral of the story is reinstall, don’t try to move disk images. Make sure your data is in SkyDrive, Dropbox, SharePoint, source control etc. so it is just applications you are missing which are quick to sort out. The only pain of a job I had was to sort out my podcasts, but even that was not too bad

Update on my experiences with Lenovo W520 Drivers and Windows 8

After I installed Windows 8 RTM I still had two devices missing drivers. I have made a little progress

  • Base System Device - was the Ricoh PCIe SDXC/MMC Host controller I used this Win 8 beta driver
  • Unknown driver – seems to be the Lenovo Power Management devices. However the  Win 8 Beta driver  fails to install. I had to use the Windows 7 driver, installed OK and seems to show the right information in the tool tray, but in Device Manager it still says the unknown driver.

I guess I really need to wait until Lenovo ship their release drivers

A move to Windows 8 RTM (and VS2012 RTM), not too painful

First I thought I could do an in-place upgrade of my Windows 8RC PC, turns out you can’t (not sure if it would have been wise anyway) so it was format disk time.

I had hoped for a seamless install of Windows 8, but it hung after detecting devices. It seems it was the ‘old problem’ down to Lenovo/Nvidia Optimus graphics drivers issues. So I checked my bios settings which were set to Nvidia Optimus mode disabled (the only way I could get the RC to install), and changed it to Optimus mode enable and the install all worked without an issue. However though as a laptop it work find,  including with a second external monitor. I did have to set Optimus back to disabled and run in discrete video mode if I wanted to use a projector. It seems the Optimus mode certainly gets confused with the Benq projector we have in the office, it will allow you to extend your desktop but not duplicate it. As soon as you switch back to discrete graphic mode all is OK (though you do lose the ability to run two external monitors)

On completing the installation I ran a Windows update which found an update Lenovo display driver (it had no effect on the Optimus issue) and Conexant audio driver (one I had to manually update on the RC to get Lync 2013 working).

However, on checking the Device Manager I was still missing drives for a couple of devices

image

I think they are Power Management and Intel AMT, but the beta drivers from Lenovo don’t seem to work so I will need to keep looking.

So now to see how it runs, first impressions are good, seem quick.