openrasta/openwrap — Issue #291: o build-wrap FormatException
Author: chriseldredge
Created: 2012-01-05 23:34:52+00:00
State: open

When "o build-wrap" invokes msbuild, if the build output includes any curly braces, such as is the case when it cannot resolve an assembly reference, the command will fail due to a FormatException.

In practice this can happen when a csproj includes an unused reference to an assembly that cannot be resolved, and msbuild emits output similar to:
```ResolveAssemblyReferences:
Primary reference "Microsoft.SqlServer.TxScript, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.SqlServer.TxScript, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
For SearchPath "{TargetFrameworkDirectory}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\Microsoft.SqlServer.TxScript.dll", but it didn't exist.```

The {TargetFrameworkDirectory} line is the one that causes the problem.

The problem appears in BuildWrapCommand:409 because the output line is treated as a message format instead of being treated as a literal.