Coder Social home page Coder Social logo

codegeneratortest's Introduction

Don't believe in myths!

Do you think that only C# version 9.0 onwards supports code generators? .NET Framework projects be darned, Visual Basic the usual disgraced son?

Well, think again.

Code generators are a compiler feature, not a language feature. As long as you build your project with the .NET SDK v6.0 and/or Visual Studio 2022, you can benefit from incremental generators, for example.

(Of course you need to use Roslyn as a compiler; therefore, F# projects are not invited to the party - sorry guys, but hey, your language is so cool you don't even need this kind of stuff, right? ๐Ÿ˜‰)

Don't believe me, either: see for yourself.

Instructions for Visual Studio

  1. Clone this project.
  2. Open CodeGenerationTest.sln in Visual Studio 2022 (v17.2+ recommended) and build the CodeGenerators project.
  3. Exit Visual Studio, then open the solution again. This step is needed because VS caches code generators and will not recognize the newly-compiled CodeGenerators.dll until you restart it.
  4. Open Program.cs in the CSharpApp project. Verify that there are no errors: both the Hello class and its World property are present in the assembly, despite this project targeting .NET Framework 4.6.1 (thus, by default, using C# 7.3).
  5. Open Program.vb in the VisualBasicApp project. Verify that there are no errors: both the Hello module and its World property are present in the assembly, despite this project being in Visual Basic (and, for good measure, explicitly specifying version 15.0 of the language).

Instructions for .NET SDK

On a computer with .NET SDK v6.0 or later installed:

  1. Clone this project.
  2. Open the operating system shell of your choice in the folder where you cloned this project.
  3. Enter the dotnet build command. Verify that there are no errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.