Solving: MSBUILD : error : Unable to read Code Analysis output report. Make sure that the directory is writable (default is the project output directory).

2012-01-11

Today a new error popped up in Team Build. One we've never seen before and one that doesn't happen in Visual Studio during the build.

The error was:
MSBUILD : error : Unable to read Code Analysis output report. Make sure that the directory is writable (default is the project output directory). [MyProjectA.csproj]
A quick search pointed to a few possible solutions, luckily we weren't the first to experience this:
  1. Reduce the path length to be below 260 characters. As the old Windows API imposes a restriction of the total length a file name is allowed to be.
  2. Remove the 
    <CodeAnalysisLogFile>bin\Release\MyProjectA.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
     lines from the .csproj file
  3. Clean the Team Build workspace to ensure that an older version of this file isn't causing any issues.
For us it turned out that a combination of 2 & 3 solved the issue. After removing the lines from the project file and running a build which clears the TFS workspace we're no longer experiencing the errors. 

Funny issue with Code Coverage and Reflection

2012-01-09

Just stumbled upon a tricky change which happens to your assemblies when you're running your tests with Code Coverage enabled.

Take the following piece of code:
var types = typeof(Program).Assembly.GetExportedTypes();
foreach (Type t in types)
{
     // ...
}

In our case the behavior of the code under test changed completely between a debug run, a normal test run and a run with Code Coverage enabled. And the most difficult issue is that you can't gather Code Coverage data with the debugger attached.

Answer after the break.

Windows Azure Appfabric RelayConfigurationInstaller and FileNotFoundException

2012-01-05

After installing the 1.6 version of the Azure SDK I tried re-registering the service bus bindings to the machine.config.

In v1.5 this was pretty easy, open an command prompt (with admin privileges) and run "RelayConfigurationInstaller /i". The documentation for this tool hasn't been updated for the new folder structure in v1.6.

Now when you run the tool (after you've found it) it will throw an exception:

C:\Program Files\Windows Azure SDK\v1.6\ServiceBus\bin>RelayConfigurationInstaller.exe /i

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or 
assembly 'Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=
31bf3856ad364e35' or one of its dependencies. The system cannot find the file 
specified.
   at Microsoft.ServiceBus.Configuration.Program.Main(String[] args)

To run the installer, first open a Visual Studio command line and navigate to: "C:\Program Files\Windows Azure SDK\v1.6\ServiceBus\ref".

Use GacUtil /i to add the Microsoft.ServiceBus assembly to the GAC from the bin folder. Then execute the RelayConfigurationInstaller from the ref folder.
 

Most Reading