- Roslyn Cookbook
- Manish Vasani
- 280字
- 2021-07-15 17:07:38
How to do it...
- Create a C# class library project, say ClassLibrary, in Visual Studio 2017.
- From the top-level menu, navigate to Tools | Extensions and Updates.
- Navigate to Online | Visual Studio Marketplace on the left tab of the dialog to view the available VSIXes in the Visual Studio extension gallery/marketplace:

- Search analyzers in the search textbox in the upper-right corner of the dialog and download an analyzer VSIX, say Refactoring Essentials for Visual Studio:

- Once the download completes, you will get a message at the bottom of the dialog saying that the install will be scheduled to execute once Visual Studio and related windows are closed:

- Close the dialog and then close the Visual Studio instance to start the install.
- In the VSIX Installer dialog, click on Modify to start installation:

- The subsequent message prompts you to kill all the active Visual Studio and satellite processes. Save all your relevant work in all the open Visual Studio instances and click on End Tasks to kill these processes and install the VSIX:

- After installation, restart VS, click on Tools | Extensions And Updates, and verify that Refactoring Essentials VSIX is installed:

- Create a new C# project with the following source code and verify analyzer diagnostic RECS0085 (Redundant array creation expression) in the error list:
namespace ClassLibrary
{
public class Class1
{
void Method()
{
int[] values = new int[] { 1, 2, 3 };
}
}
}

- Build the project from Visual Studio 2017 or the command line and confirm that no analyzer diagnostic shows up in the output window or the command line, respectively, confirming that the VSIX analyzer did not execute as a part of the build.
推薦閱讀
- 無代碼編程:用云表搭建企業數字化管理平臺
- Python程序設計(第3版)
- Building Mapping Applications with QGIS
- TypeScript實戰指南
- ASP.NET 3.5程序設計與項目實踐
- Java EE 7 Performance Tuning and Optimization
- Julia高性能科學計算(第2版)
- Unity 2D Game Development Cookbook
- 蘋果的產品設計之道:創建優秀產品、服務和用戶體驗的七個原則
- C++ Fundamentals
- Cocos2d-x Game Development Blueprints
- Angular Design Patterns
- 面向對象程序設計及C++(第3版)
- SQL Server on Linux
- Unity AI Game Programming(Second Edition)