You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

installing.md 4.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ---
  2. title: Installing Discord.Net
  3. ---
  4. Discord.Net is distributed through the NuGet package manager, and it is
  5. recommended to use NuGet to get started.
  6. Optionally, you may compile from source and install yourself.
  7. # Supported Platforms
  8. Currently, Discord.Net targets [.NET Standard] 1.3, and offers support for
  9. .NET Standard 1.1. If your application will be targeting .NET Standard 1.1,
  10. please see the [additional steps](#installing-on-.net-standard-11).
  11. Since Discord.Net is built on the .NET Standard, it is also recommended to
  12. create applications using [.NET Core], though you are not required to. When
  13. using .NET Framework, it is suggested to target `.NET 4.6.1` or higher.
  14. [.NET Standard]: https://docs.microsoft.com/en-us/dotnet/articles/standard/library
  15. [.NET Core]: https://docs.microsoft.com/en-us/dotnet/articles/core/
  16. # Installing with NuGet
  17. Release builds of Discord.Net 1.0 will be published to the
  18. [official NuGet feed].
  19. Development builds of Discord.Net 1.0, as well as [addons](TODO) are published
  20. to our development [MyGet feed].
  21. Direct feed link: `https://www.myget.org/F/discord-net/api/v3/index.json`
  22. Not sure how to add a direct feed? See how [with Visual Studio]
  23. or [without Visual Studio](#configuring-nuget-without-visual-studio)
  24. [official NuGet feed]: https://nuget.org
  25. [MyGet feed]: https://www.myget.org/feed/Packages/discord-net
  26. [with Visual Studio]: https://docs.microsoft.com/en-us/nuget/tools/package-manager-ui#package-sources
  27. ## Using Visual Studio
  28. 1. Create a solution for your bot
  29. 2. In Solution Explorer, find the 'Dependencies' element under your bot's
  30. project
  31. 3. Right click on 'Dependencies', and select 'Manage NuGet packages'
  32. ![Step 3](images/install-vs-deps.png)
  33. 4. In the 'browse' tab, search for 'Discord.Net'
  34. > [!TIP]
  35. Don't forget to change your package source if you're installing from the
  36. developer feed.
  37. Also make sure to check 'Enable Prereleases' if installing a dev build!
  38. 5. Install the 'Discord.Net' package
  39. ![Step 5](images/install-vs-nuget.png)
  40. ## Using JetBrains Rider
  41. **todo**
  42. ## Using Visual Studio Code
  43. **todo**
  44. # Compiling from Source
  45. In order to compile Discord.Net, you require the following:
  46. ### Using Visual Studio
  47. - [Visual Studio 2017](https://www.visualstudio.com/)
  48. - [.NET Core SDK 1.0](https://www.microsoft.com/net/download/core#/sdk)
  49. The .NET Core and Docker (Preview) workload is required during Visual Studio
  50. installation.
  51. ### Using Command Line
  52. - [.NET Core SDK 1.0](https://www.microsoft.com/net/download/core#/sdk)
  53. # Additional Information
  54. ## Installing on .NET Standard 1.1
  55. For applications targeting a runtime corresponding with .NET Standard 1.1 or 1.2,
  56. the builtin WebSocket and UDP provider will not work. For applications which
  57. utilize a WebSocket connection to Discord (WebSocket or RPC), third-party
  58. provider packages will need to be installed and configured.
  59. First, install the following packages through NuGet, or compile yourself, if
  60. you prefer:
  61. - Discord.Net.Providers.WS4Net
  62. - Discord.Net.Providers.UDPClient
  63. Note that `Discord.Net.Providers.UDPClient` is _only_ required if your bot will
  64. be utilizing voice chat.
  65. Next, you will need to configure your [DiscordSocketClient] to use these custom
  66. providers over the default ones.
  67. To do this, set the `WebSocketProvider` and optionally `UdpSocketProvider`
  68. properties on the [DiscordSocketConfig] that you are passing into your
  69. client.
  70. [!code-csharp[NET Standard 1.1 Example](samples/netstd11.cs)]
  71. [DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient
  72. [DiscordSocketConfig]: xref:Discord.WebSocket.DiscordSocketConfig
  73. ## Configuring NuGet without Visual Studio
  74. If you plan on deploying your bot or developing outside of Visual Studio, you
  75. will need to create a local NuGet configuration file for your project.
  76. To do this, create a file named `nuget.config` alongside the root of your
  77. application, where the project solution is located.
  78. Paste the following snippets into this configuration file, adding any additional
  79. feeds as necessary.
  80. [!code-xml[NuGet Configuration](samples/nuget.config)]