Marko Apfel - Afghanistan/Belgium/Germany

Management, Architecture, Programming, QA, Coach, GIS, EAI

  Home  |   Contact  |   Syndication    |   Login
  187 Posts | 2 Stories | 201 Comments | 4 Trackbacks


Twitter | LinkedIn | Xing


Post Categories



Enterprise Library


SQL Server


After installing VS2005 TE on my machine (which previously runs Visual Studio 2008 TE) all mixed projects (VS2005/VS2008 compatibility with TargetFramework=2.0 and ToolsVersion=2.0 options) thrown an error during compilation:

C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(46,4):
error : In order to perform Code Analysis on managed binaries, MSBuild needs to launch FxCop.
MSBuild is unable to locate the FxCop binaries.
Make sure Visual Studio Team Edition for Software Developers or Visual Studio Team Suite is installed 
and run MSBuild from within the "Visual Studio Command Prompt" 
or specify the path to FxCop by setting the FXCOPDIR environment variable.

Specifying the FXCOPDIR-variable brings up the next obscure errors.

Replacing the VS2005 CodeAnalysis targets with the VS2008 targets lets run everything fine.

So replace [dont forget to make a backup ;-)]

C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\CodeAnalysis


C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\CodeAnalysis

But now you get an error in Visual Studio 2005:

MSBUILD : error : Invalid settings passed to CodeAnalysis task. See output window for details.
Code Analysis Complete -- 1 error(s), 0 warning(s)

Setting the build output information to diagnostic you get an good hint what the problem is.

So we edit as the last step the VS2005 target:

the line

<UsingTask TaskName="Microsoft.Build.Tasks.CodeAnalysis" AssemblyFile=".\FxCopTask.dll"/>

we modify to:

<UsingTask TaskName="Microsoft.Build.Tasks.CodeAnalysis" AssemblyFile="..\..\v9.0\CodeAnalysis\FxCopTask.dll"/>


and the following lines

<CodeAnalysisPath Condition="'$(CodeAnalysisPath)'=='' and '$(FxCopDir)'!='' and '$(TeamBuildConstants)'==''">$(FxCopDir)</CodeAnalysisPath>
<CodeAnalysisPath Condition="'$(CodeAnalysisPath)'=='' and '$(VSINSTALLDIR)'!=''">$(VSINSTALLDIR)\Team Tools\Static Analysis Tools\FxCop</CodeAnalysisPath>

are replaced with

<CodeAnalysisPath>C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop</CodeAnalysisPath>


not beautiful – but working!

posted on Thursday, November 26, 2009 12:52 PM