Git Product home page Git Product logo

csharp-project-template-for-vscode's Introduction

C# Project Template for VSCode

This is a simple C# project template meant to accelerate Mono and .NET Framework workflows in Visual Studio Code.

Rather than using .NET Core, this project exclusively uses Mono and .NET Framework tooling (via msbuild). As a result, output binaries will be .exe files instead of the .dll files that .NET Core produces. This is more in line with the behavior of the Visual Studio 2017 / Visual Studio for Mac.

Features:

  • Uses the new .csproj format, so you can easily edit the project by hand.
    • Because of this, the template folder is copy-pastable. No need to worry about unique project GUIDs!
  • Works on Mac and Windows.
  • Convenient build tasks:
    • Restore Project: Initializes the project and updates project data. Run this every time you set up a new project, and again if you add references to other projects.
    • Build (Debug/Release): Builds the project with the selected configuration.
    • Build and Run (Debug/Release): Builds the project with the selected configuration and subsequently runs it with Mono on Mac or .NET Framework on Windows.
    • Clean Project: Cleans the output directory.
  • Debugging support:

Prerequisites:

Instructions:

  1. Download and unzip the ZIP archive.
  2. Copy the Template folder and paste it wherever you want. Rename it to the name of your new project.
  3. Open the folder in VS Code.
  4. Rename the csproj file from project_name to the intended name of your project.
  5. Do a Find+Replace for project_name in the project to change every occurence to your actual project name.
  6. From the Command Pallete, run the "Restore Project" build task to initialize the project.
  7. From the VSCode Command list, restart OmniSharp so that Intellisense can take effect. You may also want to change the project's settings.json so you don't have to do this every time you open the project.
  8. From the Command Pallete, you can now build (and optionally run) your project.

Why Does This Exist?

The creation of this project was motivated by wanting to develop C# projects on Mac, and finding out that...

  1. .NET Core is a opinionated and temperamental beast. I have high hopes for its future, but it's got a lot of weird bits right now. For instance, it builds dll's instead of exe's (???), the CoreCLR behaves very differently than Mono or .NET Framework in certain conditions, and it's not always compatible with projects created for .NET Framework.
  2. Visual Studio for Mac runs projects in some black-box way that differs from just running Mono, leading to frustrating and inconsistent behavior. For instance, VS for Mac doesn't appear to use any of the default Mac search paths for .dylib files, making dynamic linking near impossible. In contrast, mono finds and links external libraries without a problem.

Known Issues:

  • This hasn't been thoroughly tested, so there may be significant bugs.
  • No Linux support for Build+Run tasks. In theory this should be really easy to add (just copy-paste the osx part of the tasks.json file and change it to linux) but I don't have a Linux machine to test on.

csharp-project-template-for-vscode's People

Contributors

thespydog avatar

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.