Problem with Code Analysis in Team Architect

Last Tuesday I encountered a problem with building code and checking-in code from within the Team Edition for Software Architects of Visual Studio 2005. To explain what went wrong, let me first explain the situation and tie in with some of my previous posts.

At home I run the Team Suite Trial SKU of Visual Studio 2005. My Team Foundation Server was running inside a Virtual Machine on a laptop. I had created a Team Project there with a "clean build" code analysis check-in policy.

I took this Virtual Machine with me to the office of LogicaCMG I work at. There I moved the Team Foundation Server (TFS) over to a machine running Virtual Server. On my laptop I installed a Virtual Machine running the Team Architect SKU that had been prepared by a colleague. This Virtual Machine is joined to a domain, while the TFS is running in workgroup mode. You might think that this might be a problem, but this works just fine. You can connect from a Team System Client joined to a domain to a TFS running in workgroup mode. The account name you login with on the client doesn't even have to match with an account on the TFS. When you connect to the TFS you are prompted once for a username and password.

After connecting to the TFS, I could fetch the project I created at home from source control. But when I wanted to compile the code I got the following error:

Screenshot of a code analysis tool error in Visual Studio 2005 Team Architect (click for larger version)

NullReferenceException was thrown from the method Microsoft.Build.Tasks.CodeAnalysis.GenerateFullPathToTool(), causing an unexpected failure of the CodeAnalysis task. I guessed this was due to the fact that the Team Architect SKU does not support code analysis. You can see this through the absence of the Code Analysis tab in the Properties window for a Visual Studio Project. This a chart (from MSDN) that compares the features of the Team System Client SKUs:

Chart with a comparison of the different Visual Studio 2005 Team System Client SKUs (click to view image)

But the error message was not really a polite way to say that code analysis is not suppored. A small investigation showed that I do have a C:Program FilesMSBuildMicrosoftVisualStudiov8.0CodeAnalysisFxCopTask.dll file. This assembly is called by MSBuild when running the code analysis after compilation. Using .NET Reflector showed that the offending method is contained in this assembly. MSBuild tries to run code analysis because of this line in the .csproj file:


I could not find a way to turn this off in the Team Architect SKU other than through editing the project file in Notepad. The project compiled fine however, so I tried to check-in the code to Team System Source Control. This did not work. I got the following check-in policy violation:

Screenshot of a check-in policy violation in Team Architect when code analysis fails (click for larger version)

The only way I found to circumvent this problem was to ignore the policy violation and override the policy to check-in anyway. So this begs the question: are architects not supposed to run code analysis if they check in code for a Team Project? How are architects supposed to collaborate on code when they are part of a Team Project that has a code-analysis check-in policy?

In most projects I work on, the application architect also has a reviewing role and is responsible for the quality of the code. This means that he or she should be the person setting the code analysis rules. But maybe Microsoft is aiming Team Architect at architects who are not involved in coding. But even if the architect does not write code and only designs the application using the Whitehorse designers, code still gets generated. This code has to be checked in by the architect and he/she might run into the code analysis problems I described above.  If this is by design and not just a bug on my installation, it is an extra reason for me to get an upgrade to a non-trial version of Team Suite.

If you have any ideas about this, please let me know, by leaving a comment.

[Update 2005-11-16: In response to a post in the MSDN Forum for Team System, Microsoft has confirmed that code analysis is absent by design in Team Architect but that Visual Studio should not throw exceptions when building a project with code analysis enabled. I also reported this issue in the MSDN Product Feedback Center.]

One thought on “Problem with Code Analysis in Team Architect

  1. Thanks for your feedback. Part of this issue is by design, the other part is a bug.

    First the Bug:
    The NullReferenceException is indeed a bug. If you delete or rename the directory "Program FilesMSBuildMicrosoftVisualStudiov8.0CodeAnalysis" it will not occur.

    This directory is incorrectly installed by Team Foundation Client, it should only be installed with VS Team Suite and VS Team Developer.

    We hope to fix this issue soon.

    Now the design:
    Code Analysis tools are not available in VS Team Architect. It was packaging decision to make this only available in Team Edition for Developer and the Team Suite SKU ( Therefore, if Code Analysis Policy is enabled, it will require policy to be overriden.

    If you feel strongly about this, contact Rick (Team System - General Manager):

    Rick is very open to customer feedback.


    Ali Pasha
    Program Manager - Microsoft


Leave a Reply

Your email address will not be published. Required fields are marked *