Visual studio 直接通过VS项目文件运行FxCop

Visual studio 直接通过VS项目文件运行FxCop,visual-studio,fxcop,Visual Studio,Fxcop,我感兴趣的是,通过在.csproj文件本身中将FxCop作为目标调用,而不为项目创建单独的MSBuild文件,将FxCop设置为在开发环境中的每个VS.csproj文件上运行。这是吗 <Target Name="AfterBuild"> <Exec Command="&quot;C:\Program Files\Microsoft FxCop\FxCopCmd.exe&quot; /searchgac /p:FxCopProject.fxcop /out:

我感兴趣的是,通过在.csproj文件本身中将FxCop作为目标调用,而不为项目创建单独的MSBuild文件,将FxCop设置为在开发环境中的每个VS.csproj文件上运行。这是吗

<Target Name="AfterBuild">
   <Exec Command="&quot;C:\Program Files\Microsoft FxCop\FxCopCmd.exe&quot; /searchgac /p:FxCopProject.fxcop /out:FxCopOutput.xml" ContinueOnError="true">
   </Exec>
</Target>


我的.csproj文件末尾包含了以某种方式工作的可能性吗?

我想您正在寻找生成后事件

  • 右键单击项目
  • 单击属性
  • 转到“生成事件”选项卡
  • 将命令行添加到“生成后事件命令行”框中

  • 我想您正在寻找后期构建事件

  • 右键单击项目
  • 单击属性
  • 转到“生成事件”选项卡
  • 将命令行添加到“生成后事件命令行”框中

  • 以下操作应该有效-将其粘贴到节点级别下的任意位置:

      <PropertyGroup>
        <PostBuildEvent>"%25ProgramFiles%25\Microsoft FxCop 1.36\FxCopCmd.exe" /p:$(SolutionDir)Bank.FxCop /o:$(TargetDir)FxCopResults.xml /d:"%25ProgramFiles%25\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies"
      </PropertyGroup>
    
    
    %25ProgramFiles%25\Microsoft FxCop 1.36\FxCopCmd.exe”/p:$(SolutionDir)Bank.FxCop/o:$(TargetDir)FxCopResults.xml/d:“%25ProgramFiles%25\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblys”
    

    请注意,我使用的/d参数指向我的项目使用其他程序集(在本例中为MSTest单元测试)的位置。

    以下操作应该有效-将其粘贴到节点级别下的任意位置:

      <PropertyGroup>
        <PostBuildEvent>"%25ProgramFiles%25\Microsoft FxCop 1.36\FxCopCmd.exe" /p:$(SolutionDir)Bank.FxCop /o:$(TargetDir)FxCopResults.xml /d:"%25ProgramFiles%25\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies"
      </PropertyGroup>
    
    
    %25ProgramFiles%25\Microsoft FxCop 1.36\FxCopCmd.exe”/p:$(SolutionDir)Bank.FxCop/o:$(TargetDir)FxCopResults.xml/d:“%25ProgramFiles%25\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblys”
    
    请注意,我使用的/d参数指向我的项目使用其他程序集的位置(在本例中,是MSTest单元测试)