Files
Discord.Net/docs/guides/getting_started/installing.md
Still Hsu fd3810e9fe docs: September 2019 Documentation Update (#1379)
* docs: adjust wording of ActivityType.Watching enum

Adjusts the xmldoc summary wording of the ActivityType.Watching enum to
fix a wording issue.

* Add D.NET Logo to Open Graph meta tags

* Update DescriptionGenerator
...And update color to suit the logo better

* Disable smooth scrolling due to user complaints

* Remove unnecessary spacing in sideaffix

* Update footer version

* Remove featherlight plugin

As it is unnecessary and can break image tags

* Adjust wordings regarding safe-handling of secrets

* Fix formatting for first bot token sample

* Add badges to homepage

* Minor wording fixes on terminal

* Update to higher quality PNG

* Add Discord.Net.Example in sln for build validation

* Clarify all instances of IAsnycEnumerable

* Clarify overridden props in SocketNewsChannel

* Add returns and params docs for SyncPermissionsAsync

* Remove/fix invalid XMLdoc strings

* Remove AppVeyor and add GitHub badge
2019-09-22 19:06:57 -04:00

4.4 KiB

uid, title
uid title
Guides.GettingStarted.Installation Installing Discord.Net

Discord.Net Installation

Discord.Net is distributed through the NuGet package manager; the most recommended way for you to install this library. Alternatively, you may also compile this library yourself should you so desire.

Supported Platforms

Discord.Net targets .NET Standard both 1.3 and 2.0; this also means that creating applications using the latest version of .NET Core is the most recommended. If you are bound by Windows-specific APIs or other limitations, you may also consider targeting .NET Framework 4.6.1 or higher.

Warning

Using this library with Mono is not supported until further notice. It is known to have issues with the library's WebSockets implementation and may crash the application upon startup.

Installing with NuGet

Release builds of Discord.Net will be published to the official NuGet feed.

Development builds of Discord.Net, as well as add-ons, will be published to our MyGet feed. See @Guides.GettingStarted.Installation.Nightlies to learn more.

Using Visual Studio

  1. Create a new solution for your bot

  2. In the Solution Explorer, find the "Dependencies" element under your bot's project

  3. Right click on "Dependencies", and select "Manage NuGet packages"

    Step 3

  4. In the "Browse" tab, search for Discord.Net

  5. Install the Discord.Net package

    Step 5

Using JetBrains Rider

  1. Create a new solution for your bot

  2. Open the NuGet window (Tools > NuGet > Manage NuGet packages for Solution)

    Step 2

  3. In the "Packages" tab, search for Discord.Net

    Step 3

  4. Install by adding the package to your project

    Step 4

Using Visual Studio Code

  1. Create a new project for your bot
  2. Add Discord.Net to your *.csproj

[!codeSample .csproj]

Using dotnet CLI

  1. Launch a terminal of your choice
  2. Navigate to where your *.csproj is located
  3. Enter dotnet add package Discord.Net

Compiling from Source

In order to compile Discord.Net, you will need the following:

Using Visual Studio

The .NET Core and Docker workload is required during Visual Studio installation.

Using Command Line

Additional Information

Installing on Unsupported WebSocket Platform

When running any Discord.Net-powered bot on an older operating system (e.g. Windows 7) that does not natively support WebSocket, you may encounter a @System.PlatformNotSupportedException upon connecting.

You may resolve this by either targeting .NET Core 2.1 or higher, or by installing one or more custom packages as listed below.

Targeting .NET Core 2.1

  1. Download the latest .NET Core SDK.
  2. Create or move your existing project to use .NET Core.
  3. Modify your <TargetFramework> tag to at least netcoreapp2.1, or by adding the --framework netcoreapp2.1 switch when building.

Custom Packages

  1. Install or compile the following packages:

    • Discord.Net.Providers.WS4Net
    • Discord.Net.Providers.UDPClient (Optional)
      • This is only required if your bot will be utilizing voice chat.
  2. Configure your DiscordSocketClient to use these custom providers over the default ones.

    • To do this, set the WebSocketProvider and the optional UdpSocketProvider properties on the DiscordSocketConfig that you are passing into your client.

[!code-csharpExample]