Wednesday, December 2, 2009

Listing all PowerShell type accelerators

Type accelerators are shortcuts (similar to aliases) for .NET type names.

For example:

[int]3.0
and
[system.int32]3.0

Are equivalent because there is a type accelerator that maps int to System.Int32. They can be very useful when dealing with longer type names such as System.Text.RegularExpressions.Regex ([regex]).

The way to list all the currently defined type accelerators is:

([type]::gettype("System.Management.Automation.TypeAccelerators"))::get | sort key

TypeAccelerators also has an Add function that can be used to define new type accelerators.

Monday, November 30, 2009

Copying the current working directory to the clipboard in PowerShell

To copy the current working directory to the clipboard, use the following command:

(get-location).ToString() | out-clipboard
Or:
(get-location).ToString() | clip

The first method requires the PowerShell Community Extensions. The second requires clip.exe, which is present on Vista (and newer) OSs, or older OSs with some resource kits installed.

Another useful trick is to start Windows Explorer in the current folder:

explorer .

Thursday, November 5, 2009

Frameworks and tools for Silverlight

To keep track of the ballooning list of frameworks and helpers that are required or helpful when working with Silverlight and/or WPF, I've started a list (in no particular order) here:

1 Silverlight Tools for VS 2008 SP1
2 Composite WPF and Silverlight (Prism)
3 Silverlight Toolkit
4 RIA Services
5 Silverlight Unit Test Framework
6 This Microsoft hotfix for a problem with unit tests in projects contained in the same solution as a Silverlight project.

Useful control toolkits:
1. Dev-express Silverlight DataGrid
2. Visifire open source data visualisation tools (charting)
3. Blacklight

Hopefully VS 2010 will roll some of these up and they won't have to be downloaded separately.

Tuesday, October 27, 2009

Prism for Silverlight

Fantastic video introduction to Prism for Silverlight.

WinDbg symbol path

Following is the path to O/S symbol files used by WinDbg.

SRV*your local symbol folder*http://msdl.microsoft.com/download/symbols

Wednesday, September 30, 2009

FxCop custom dictionary

FxCop is an excellent tool for ensuring code consistency, but sometimes I need to add domain jargon to the custom dictionary. Since there is no official XML schema for CustomDictionary.xml, the following file is the most authoritative reference:

C:\Program Files\Microsoft FxCop 1.36\CustomDictionary.xml

(If installed into the default location on a 32 bit machine.)

Tuesday, September 29, 2009

Slow builds of Windows Mobile applications

Every time I install a new machine with Visual Studio and write applications for Windows Mobile, I need to turn off the Platform Verification task to get reasonable build times, but I invariably forget how to do this.

The file is %windir%\Microsoft.NET\Framework\{newest framework version}\Microsoft.CompactFramework.Common.Targets. Open this file for editing (as administrator), and add a 'false' condition to the PlatformVerificationTask.

The line you edit should look like:
Name="PlatformVerificationTask" Condition="false">