如何在没有 nuget 或 VSIX 的情况下向项目添加自定义代码分析器? [英] How to add a custom code analyzer to a project without nuget or VSIX?

查看:48
本文介绍了如何在没有 nuget 或 VSIX 的情况下向项目添加自定义代码分析器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Visual Studio 2015 中为 C# ConsoleApplication 编写自定义代码分析器.出于这个原因,我不想从模板创建一个单独的带有代码修复的分析器"项目,因为这需要将此分析器作为 nuget 包添加到我的项目中.

I want to write a custom code analyzer in Visual Studio 2015 for a C# ConsoleApplication. For this reason I don't want to create a seperate "Analyzer with Code Fix" project from template, because this requires to add this analyzer in my projects as nuget package.


是否可以手动添加分析器引用?我想在没有 nuget 的情况下引用分析器.


Is it possible, to add a analyzer reference manually? I would like to reference the analyzer without nuget.

推荐答案

如果您将分析器添加为 Nuget 并检查您的项目内容,您将看到只有一个 <Analyzer Include="..."/> 项被添加.您可以手动执行相同操作.此外,您也可以在 .csproj.user 文件中执行此操作,因此您也可以在本地执行此操作,而无需将此更改提交到您的 SCM.

If you add an analyzer as Nuget and check the content of your project, you'll see that only an <Analyzer Include="..." /> item is added. You can do the same manually. Also, you can do this in the .csproj.user file as well, so you can also do it locally, and not commit this change to your SCM.

这篇关于如何在没有 nuget 或 VSIX 的情况下向项目添加自定义代码分析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆