Late yesterday afternoon, I updated my project source and was met with the following error when attempting to build the solution:
The target “RunCodeAnalysis” does not exist in the project.
If you have encountered this error, you know the Error List provides little help as the error description isn’t accompanied by a filename, line number or additional help. If you search the solution for “RunCodeAnalysis” you will get no results. If you review the offending project’s properties via the IDE, you won’t find a reference either…unless, of course, you’re running Visual Studio Team System. In this case, a big ol’ Code Analysis tab will be staring you in the face.
Here’s the deal. Developer Out-To-Get-Me runs Visual Studio Team System and takes advantage of the built-in code analysis tools such as FxCop. Yours truly is running the mere professional edition and has been diligently running FxCop outside of Visual Studio. Great. Developer-Out-To-Get-Me’s tool is better than my tool. The problem is the Code Analysis project settings are stored in the .csproj file and are committed to version control. I pull down the latest .csproj, compile and my version of Visual Studio barfs.
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode> <RunCodeAnalysis>true</RunCodeAnalysis> <CodeAnalysisRules>-Microsoft.Design...</CodeAnalysisRules>
I’m not sure there’s a good work around for this other than Developer Out-To-Get-Me refraining from committing their version of the project file. It would be nice if varying versions of Visual Studio handled this more gracefully though. [Note, it seems to be handled okay for VS 2008 RTM but not VS 2008 SP1 but that's another story, I think.]
For now, I’ve manually purged the project file of the above XML block and the coding gods are smiling down on my again. Next steps? Upgrade my own tools already.
Thanks a lot !!!
Thanks this helped me out.
Chen and Ryan, I’m happy to help.
Thank you, solved me problem
Here’s the workaround:
just rename the directory c:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\CodeAnalysis
Then it should work