Use mspec-clr4.exe for .NET 4 assemblies

Otherwise, you get an error like

19/03/2013 14:31:39: An Error Occurred:
Exec: Error executing command & $mspecPath @(dir “$buildFolder\*Tests*\*Tests*.dll”) .
At D:\dev\Shared\Jwt\src\packages\psake.4.2.0.1\tools\psake.psm1:139 char:14
+ throw <<<< (“Exec: ” + $errorMessage)
+ CategoryInfo : OperationStopped: (Exec: Error exe…*Tests*.dll”) .:String) [], RuntimeException
+ FullyQualifiedErrorId : Exec: Error executing command & $mspecPath @(dir “$buildFolder\*Tests*\*Tests*.dll”) .

The error is slightly misleading as it’s saying the problem is your powershell doesn’t have .net 4 loaded.

It’s true that Powershell 2 loads .NET 3.5 and doesn’t support .NET 4, but as mspec.exe is just a executable, it should’t be affected. So, use mspec-clr4, rather than mspec, if your test assemblies are built in .NET 4.

I’ve changed the $mspecPath.

$mspecPath = "$baseDir\src\packages\Machine.Specifications.0.5.12\tools\mspec-clr4.exe"
Use mspec-clr4.exe for .NET 4 assemblies

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s