Q: Why does the RunFxCop task fail when I run MSBuild from the command line?
A: When you build from the command line, the build report may contain an error for the RunFxCop task that says, "The system cannot find the path specified." This is a known problem that is fixed in later releases. It occurs because the environment variable, FxCopDir, was not defined in this release. As a workaround, you can do one of the following:
- Add the Environment Variable:
- In Control Panel, open System. The System Properties dialog box appears.
- Click the Advanced tab, and then click Environment Variables. The Environment Variables dialog box appears.
- Under System variables, click New. The New System Variable dialog box appears.
- In the Variable name box, type FxCopDir.
- In the Variable value box, type (path), and then click OK.
- Or, use MSBuild's /p command-line switch to provide the full path for FxCop:
msbuild /p:FxCopDir="C:\Program Files\Microsoft Visual Studio 8\Enterprise Developer Tools\Static Analysis Tools\FxCop"
Applicability: Visual Studio 2005 Beta 1 Refresh with Visual Studio 2005 Team System