.NET Core template library for Office 365 app development


Overview

Not long ago, I wrote an article to embrace open source, Office 365 development ushered in a new era , and I introduced to you how the typical scenarios of Office 365 development support open source platforms: Office 365 provides services in the form of REST API through Microsoft Graph, Any development platform can be easily integrated with it; Office Add-ins, SharePoint Add-ins and Microsoft Teams Apps development can be implemented based on the standard web development technology stack, and the official support for NodeJS, React, TypeScript, etc. Default support for major platforms and frameworks (both at the tool and template level).

After the article was published, I received a lot of feedback. In fact, I still care about the vast number of .NET developers in my heart. As we all know, .NET is completely open source from head to toe. For these development scenarios of Office 365, are there any out-of-the-box templates that you can use? Using the weekend, I started this new project, which is to sort out a standard .NET Core template library for everyone. Welcome to follow https://github.com/chenxizhang/dotnetcore-office365dev- templates , you can simply and rudely give it to me directly , or you can submit your template through thisstar project, and you can also give me feedback through the channel.forkpull requestissue

This set of template libraries can not only lower the threshold for the majority of .NET developers (to be precise, .NET Core developers) to learn and use the Office 365 development platform (especially how to complete OAuth authentication in different scenarios and quickly Learning the typical functions of Graph through examples), there is also a unique value that allows you to take less detours in the selection and switching process of the international version and the domestic version of the two platforms, I believe that friends who have really done this development They must be in tears now.

Hope you all like it!


Planned Supported Templates


image

prerequisites

To use these templates, you only need to have .NET Core SDK version 2.0 and above installed on your development machine. Please download and install it through the method prompted by the official website ( https://www.microsoft.com/net/download/ ). Please note that we are now cross-platform, whether Windows, Mac, or Linux supports .NET Core development.

Also, you probably need at least one code editor, you can install Visual Studio, you can use Visual Studio Code, or even any text editor. I am using Visual Studio Code .


How to install templates

Installing these templates is very simple, you only need one line of command dotnet new -i 模板标识, for example use dotnet new -i chenxizhang.dotnetcore.msgraph.console.CSharpto install the console application template that can quickly implement Microsoft Graph.


How to use templates

After the template is installed successfully, you can see these new templates in the template list, each template has a short name (Short Name), you can use these templates dotnet new 模板短名称by using, for example, dotnet new graphconsolethis command can quickly create a template based on the template A console application that can quickly implement Microsoft Graph.

Each template comes with some parameters to support different scenarios. The most typical parameter is --instancethat this parameter will tell the template engine whether the Office 365 environment you are using is the international version or the domestic version. It is a required item and there are two There are options, globalrepresenting the international version and gallatinthe domestic version, but the default will be set to the international version.

You don't need to memorize all of these parameters, but you can view the template's introduction and parameter descriptions with a command dotnet new 模板短名称 -hlike this .

Each template comes with a detailed documentation, you can click on the short name of the template in the table above to jump, and there are also links at the top of the generated code files, I very much welcome feedback from everyone.


How to uninstall a template

In the following two cases, you may need to uninstall the template

  1. you don't like these templates anymore (I hope this doesn't happen)
  2. You need to install an updated version of the template

Either way, you can uninstall at any time simply dotnet new -u 模板标识via , for example, dotnet new -u chenxizhang.dotnetcore.msgraph.console.CSharpyou can uninstall the console application template. Rest assured, I will not take a cloud with me.


Frequently Asked Questions (will be continuously updated)

  1. Which development languages ​​do these templates support?

    Currently only C# is supported. Due to limited ability and energy, there are no support plans for other languages ​​for the time being. Friends with expertise in other languages ​​(such as F#, VB.NET, etc.) are welcome to participate in this project.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324633900&siteId=291194637