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

发布于 2024-08-09 09:41:21 字数 402 浏览 4 评论 0原文

我有兴趣将 FxCop 设置为在开发环境中的每个 VS .csproj 文件上运行,方法是将其作为 .csproj 文件本身的目标调用,而无需为项目创建单独的 MSBuild 文件。这

<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 文件的末尾?

I am interested in setting up FxCop to run on each of our VS .csproj files in our developing environment by calling it as a target in the .csproj file itself without creating a separate MSBuild file for the project. Is this

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

possible to get working in one way or another being included at the tail end of my .csproj file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感性不性感 2024-08-16 09:41:21

我认为您正在寻找构建后事件。

  1. 右键单击项目,
  2. 单击“属性”,
  3. 转到“构建事件”选项卡,
  4. 将命令行添加到“构建后事件命令行”框中。

I think you're looking for the post-build event.

  1. Right Click the Project
  2. Click Properties
  3. Go to the "Build Events" Tab
  4. Add the command line to the "Post-build event command line" box.
烈酒灼喉 2024-08-16 09:41:21

以下内容应该有效 - 将其粘贴到节点级别下的任何位置:

  <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>

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

The following should work - paste it anywhere at just under the node level:

  <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>

Note the /d parameter I'm using to point to where my project is using additional assemblies (in this case, the MSTest unit testing stuff).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文