- Roslyn Cookbook
- Manish Vasani
- 410字
- 2021-07-15 17:07:26
Preface
Software developers deal with source code on a day-to-day basis. Regardless of the technology or the programming language that they work on, there are a bunch of routine tasks that they must perform on their code:
- Compile source code into the runtime-specific binary format
- Analyze source code to identify issues in the source code
- Edit source code to fix issues or refactor to improve maintenance, understandability, performance, security, and so on
- Navigate source code to search patterns, references, definitions, and relationships
- Debug source code to observe and fix runtime behavior for functionality, performances, security, and so on
- Visualize collections of source components (projects), their properties, configuration, and so on
The .NET Compiler Platform (code named Roslyn) is a platform for .NET programming languages, C# and Visual Basic, to enable building tools and extensions to perform these routine programming tasks. Notably, this platform is shared between Microsoft s .NET compilers and the Visual Studio IDE for .NET development.
Roslyn is divided into multiple programming layers, with each layer exposing public APIs to write customized tools and extensions:
- CodeAnalysis layer: Core syntax and semantic representation layer of source code. C# and Visual Basic compilers (csc.exe and vbc.exe) are written on top of this layer.
- Workspaces layer: Project and solution layer that collects a set of logically related source files. These are not coupled to any specific host, such as Visual Studio.
- Features layer: Set of IDE features built on top of the CodeAnalysis and Workspaces API such as code fixes, refactorings, IntelliSense, completion, finding references, and navigating to definition and so on. These are not coupled to any specific host, such as Visual Studio.
- Visual Studio layer: Visual Studio workspace and project system that brings together and lights up all the compiler and IDE features.
Roslyn is essentially a stack of services that has been written with two core design principles: Extensibility (for layers above and third-party plugins) and Maintainability (it has well-documented and supported public APIs across these layers). External developers or third parties can do bunch of cool stuff on top of these services:
- Write their own tools for any specific programming layer to accomplish any of the programming tasks noted previously.
- Write simple plugins (for example diagnostic analyzers, code fixes and refactorings, completion and IntelliSense providers) for specific layers.
- Perform advanced scenarios at any specific layer, such as implementing their own compiler, Workspace, IDE, or project system, and all the other functionality across the stack lights up automagically.
- HTML5+CSS3+JavaScript從入門到精通:上冊(微課精編版·第2版)
- Android和PHP開發最佳實踐(第2版)
- Learn to Create WordPress Themes by Building 5 Projects
- Effective C#:改善C#代碼的50個有效方法(原書第3版)
- HTML5 移動Web開發從入門到精通(微課精編版)
- 數據結構(Java語言描述)
- 微服務設計原理與架構
- JavaScript從入門到精通(第3版)
- C語言程序設計學習指導與習題解答
- INSTANT Django 1.5 Application Development Starter
- JavaScript入門經典
- 組態軟件技術與應用
- Fastdata Processing with Spark
- 網絡數據采集技術:Java網絡爬蟲實戰
- Sitecore Cookbook for Developers