IPFilter Updated to 1.0.0.1

I’ve updated the IPFilter Updater for uTorrent to version 1.0.0.1 and you can get it here.

Dependency Property ReSharper Live Template

Dependency Property ReSharper Live Template

Don’t you love Dependency Properties?

After the ease of automatic properties though, dependency properties are a chore to define.

If you’ve got ReSharper (if not, why not?), I’ve got a simple Live Template you can use to create your dependency properties.

I’ve set it up to use the dp keyword.

Here it is in use. Typing dp first to pop up the template:

image

Hitting tab or enter will run the template, with the name macro already selected:

image

Type in the name of the property. This will set up the wrapper property with that name, and the dependency property’s name will be the name you chose, with “Property” added to the end.

For example, I type in MyCaption as the property name:

image

Hitting tab shifts me to the next macro, which is the type for the dependency property:

image

My property will be of type string, so typing that in will bring up string in the suggestions. Hitting tab will select this; hitting tab again will confirm this as my type, and select the next and last macro, the owner type:

image

This will automatically be set to the name of the containing type anyway, so you can normally leave this as is; hit tab one more time and you’re done.

HOW TO: Detect if the Visual C++ 2010 redistributable package is installed with WiX

As noted by Aaron Stebner, there is now a registry key you can search for to detect if the Visual C++ 2010 redistributable package is installed a machine, when installing your application.

There are 3 different (but very similar) registry keys for each of the 3 platform packages. Each key has a DWORD value called “Installed” with a value of 1.

  • HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86
  • HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x64
  • HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\ia64

Here’s an example of using this in WiX, detecting the presence of the x86 version of the redistributable:

<?xml version="1.0" encoding="utf-8"?>
    <Include>
        <!-- Visual C++ 2010 x86 -->
        <Property Id="HASVCPP2010">
        <RegistrySearch Id="HasVCPP2010Search" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" Name="Installed" Type="raw" />
    </Property>   
    <Condition Message="This application requires Microsoft Visual C++ 2010 Redistributable Package (x86).">Installed OR (HASVCPP2010)</Condition>
</Include>

When someone runs your installer and they don’t have this package installed, they will get something like this message box when the installer initializes:

image

It’s a good idea to have a setup bootstrapper that automatically installs this package if it’s missing, but this WiX snippet is a good safe-guard for if someone directly runs your MSI.

Reference: http://blogs.msdn.com/b/astebner/archive/2010/05/05/10008146.aspx

HOW TO: Debug a Windows Installer custom action

Prerequisites:

  • Determine the name of the custom action you want to debug
  • Ensure you have the source code and debug symbols for your custom action

Steps

  1. Set the MsiBreak environment variable (user or system) to the name of the custom action. For example:

    Setx MsiBreak MyCustomActionName

  2. Run your installer
  3. At the point where your custom action is about to run, you should get this message box prompt:

  4. Now you can use Visual Studio or another debugger such as WinDBG to attach to the specified process.
  5. Click OK on the message box
  6. This should break into your debugger. This is a good time to set your breakpoints in your custom action code.
  7. When ready, run/continue the debug session.
  8. Your custom action should run and your breakpoint(s) will be hit.

References:

Debugging Custom Actions @ msdn.microsoft.com

Building Visual Studio 2010 Solutions in Team Foundation Server Build 2008

Visual Studio 2010 and Team Foundation Server 2010 have been out for a while. But what if you still have Team Foundation Server 2008 but want to build Visual Studio 2010 solutions on it?

You can do so by updating the Team Foundation Build Service configuration to use the latest version of MSBuild that comes with the .NET Framework 4.0.

  1. Open up %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\tfsbuildservice.exe.config in a text editor
  2. Find the MSBuildPath property, which will likely be empty, and enter the path to the .NET Framework 4.0 folder (C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\):
  3. Save the file
  4. Restart the  Visual Studio Team Foundation Build service

Reference: http://blogs.msdn.com/b/jimlamb/archive/2009/11/03/upgrading-tfs-2008-build-definitions-to-tfs-2010.aspx

Opera 10.5 Beta and Windows 7 Integration

Opera 10.5 Beta is out and it’s very impressive, and looks pretty stunning due to its Windows 7 integration.

One thing I don’t really like is how it shows all the tabs using Aero Peek when you click it in the Task Bar.

You can turn this off:

  1. Type “opera:config” in the address bar and hit Enter
  2. Scroll down to User Prefs and expand it, or type in “Windows 7″ in the search box
  3. Untick the “Use Windows 7 Taskbar Thumbnails” setting
  4. Click Save
  5. Restart Opera

Speccy gives you detailed system info

From Piriform, the makers of CCleaner, comes a very useful and promising system information summary tool.

It’s called Speccy:

image 

You can Download Speccy Here , including a handy portable version

Running 32-bit Remote Desktop Connection on Windows 64 bit

On Windows Vista 64 and Windows 7 64, there is a 32 bit version of Remote Desktop Connection (Microsoft Terminal Services Client, mstsc.exe) in %SystemRoot%\SysWOW64.

Running this mstsc.exe will launch the 32 bit process but it will instantly launch the 64-bit mstsc.exe from System32 and shut itself down. This makes it impossible to run Remote Desktop Connection 32 bit.

This is a problem when you have 32 bit Terminal Services add-ins (which won’t run under 64 bit).

Solution: Rename the 64-bit mstsc.exe from System32 to prevent it from replacing the 32-bit process.

This is simple if you have rights to rename that file. If you’re on NTFS you may get a “You require permission from TrustedInstaller to make changes to this file” error.

To get by this error, you can take Ownership of the file and give yourself full permissions:

  1. Browse to %SystemRoot%\System32
  2. Right click mstsc.exe and choose Properties
  3. Go to the Security tab
  4. Click Advanced
  5. Go to the Owner tab
  6. Click Edit
  7. From the “Change owner to:” list, choose your user name
  8. Click OK
  9. Go to the Permissions tab
  10. Click Change Permissions…
  11. Click Add
  12. Enter your user name and click OK
  13. Tick the box in the Allow column for Full control
  14. Click OK
  15. Click OK
  16. A Windows Security warning will come up; click Yes to proceed
  17. Click OK

Now, you can rename the file mstsc.exe to something like mstsc.exe.bak

Then, you can launch mstsc.exe from %SystemRoot%\SysWOW64 and you will have 32-bit Remote Desktop Connection running.

Free Anti-Virus: Microsoft Security Essentials

Microsoft Security Essentials is a free anti-virus program.

All of the free anti-virus programs out there have usually pretty quickly fallen out of favour with me, in particular the previous community darling AVGFree.

Having a free option from Microsoft, that performs extremely well with minimal resource usage, is a boon.

For privacy reasons, you might want to opt out of the Microsoft SpyNet. Opting out is a very manual process though, with instructions here

Download Microsoft Security Essentials

Generating GUIDs from Visual Studio 2008

I find I have to generate GUIDs often (mostly due to using WiX) and the in-built Tools > Create GUID tool is too cumbersome for this.

I found a blog post that has a simple macro you can customize to bind a keyboard shortcut to paste in a new GUID

Here are some full instructions, using their simple macro code:

  1. Tools > Macros > Macro Explorer (or hit ALT+F8)
  2. Right click Macros, choose New Macro Project…
  3. Choose a location for the Macro project and give it a meaningful name then click Add
  4. Rename Module1 to something more meaningful, then double-click to edit the module
  5. Insert the code to paste a new GUID into the current cursor position / selection:

    Public Sub PasteNewGuid()
    DTE.ActiveDocument.Selection.Text = "{" & System.Guid.NewGuid().ToString("D").ToUpper() & "}"
    End Sub
  6. Save the macro project and close the Macro IDE
  7. In Visual Studio: Tools > Options, select Environment > Keyboard
  8. Find the macro command you created (you can use the Show commands containing: to search on guid)
  9. Select the command in the list
  10. Ensure Use new shortcut in: has Global selected
  11. Place the cursor in Press shortcut keys: and hit the shortcut (ALT+G for me)
  12. Hit OK
  13. Test it out