Browse Source

Rewrite installation page for Core 2.1

pull/1161/head
Still Hsu 7 years ago
parent
commit
adbb66d9d7
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
3 changed files with 46 additions and 27 deletions
  1. +1
    -1
      docs/guides/getting_started/first-bot.md
  2. +43
    -24
      docs/guides/getting_started/installing.md
  3. +2
    -2
      docs/guides/getting_started/samples/project.xml

+ 1
- 1
docs/guides/getting_started/first-bot.md View File

@@ -176,7 +176,7 @@ online in Discord.
[DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient [DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient
[LoginAsync]: xref:Discord.Rest.BaseDiscordClient.LoginAsync* [LoginAsync]: xref:Discord.Rest.BaseDiscordClient.LoginAsync*
[StartAsync]: xref:Discord.WebSocket.DiscordSocketClient.StartAsync* [StartAsync]: xref:Discord.WebSocket.DiscordSocketClient.StartAsync*
[installation guide]: xref:Guides.GettingStarted.Installation#installing-on-net-standard-11
[installation guide]: xref:Guides.GettingStarted.Installation#unsupported-platform


### Handling a 'ping' ### Handling a 'ping'




+ 43
- 24
docs/guides/getting_started/installing.md View File

@@ -13,14 +13,14 @@ yourself.


## Supported Platforms ## Supported Platforms


Currently, Discord.Net targets [.NET Standard] 1.3 and offers support
for .NET Standard 1.1. If your application will be targeting .NET
Standard 1.1, please see the [additional steps].
Currently, Discord.Net targets [.NET Standard] 1.3 and 2.0.


Since Discord.Net is built on top of .NET Standard, it is also Since Discord.Net is built on top of .NET Standard, it is also
recommended to create applications using [.NET Core], although it is not
required. When using .NET Framework, it is suggested to target
`.NET Framework 4.6.1` or higher.
recommended to create applications using [.NET Core],
although it is not required.

When using .NET Framework, it is suggested to
target `.NET Framework 4.6.1` or higher.


> [!WARNING] > [!WARNING]
> Using this library with [Mono] is not recommended until further > Using this library with [Mono] is not recommended until further
@@ -113,38 +113,53 @@ In order to compile Discord.Net, you will need the following:


### Using Visual Studio ### Using Visual Studio


- [Visual Studio 2017](https://www.visualstudio.com/)
- [.NET Core SDK]
* [Visual Studio 2017](https://www.visualstudio.com/)
* [.NET Core SDK]


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


### Using Command Line ### Using Command Line


- [.NET Core SDK]

[.NET Core SDK]: https://www.microsoft.com/net/download/
* [.NET Core SDK]


## Additional Information ## Additional Information


### Installing on .NET Standard 1.1
### <a id="unsupported-platform"/> Installing on Unsupported WebSocket Platform

For older system such as Windows 7 or earlier that do not natively
support WebSocket, you may encounter
@System.PlatformNotSupportedException upon connection.

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

#### [Targeting .NET Core 2.1](#tab/core2-1)

First, make sure your installed SDK supports .NET Core 2.1.
Enter `dotnet --version`; the version number should be equal to or above
`2.1.300`. If not, visit [.NET Core SDK] website to download the latest
version.

Next, ensure your project is set to target Core 2.1; you should replace
the `<TargetFramework>` tag in your project file to `netcoreapp2.1` or
above. Alternatively, you may specify the target framework upon build
using the `-f` or `--framework` parameter.

* For example, `dotnet build -c Release -f netcoreapp2.1`


For applications targeting a runtime corresponding with .NET Standard
1.1 or 1.2, the built-in WebSocket and UDP provider will not work. For
applications which utilize a WebSocket connection to Discord, such as
WebSocket or RPC, third-party provider packages will need to be
installed and configured.
#### [Custom Packages](#tab/custom-pkg)

First, install the following packages through NuGet, or, if you prefer
compile them yourself:

* `Discord.Net.Providers.WS4Net`
* `Discord.Net.Providers.UDPClient`


> [!NOTE] > [!NOTE]
> `Discord.Net.Providers.UDPClient` is _only_ required if your > `Discord.Net.Providers.UDPClient` is _only_ required if your
> bot will be utilizing voice chat. > bot will be utilizing voice chat.


First, install the following packages through NuGet, or compile them
yourself, if you prefer:

- Discord.Net.Providers.WS4Net
- Discord.Net.Providers.UDPClient

Next, you will need to configure your [DiscordSocketClient] to use Next, you will need to configure your [DiscordSocketClient] to use
these custom providers over the default ones. these custom providers over the default ones.


@@ -152,11 +167,13 @@ To do this, set the `WebSocketProvider` and the optional
`UdpSocketProvider` properties on the [DiscordSocketConfig] that you `UdpSocketProvider` properties on the [DiscordSocketConfig] that you
are passing into your client. are passing into your client.


[!code-csharp[NET Standard 1.1 Example](samples/netstd11.cs)]
[!code-csharp[Example](samples/netstd11.cs)]


[DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient [DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient
[DiscordSocketConfig]: xref:Discord.WebSocket.DiscordSocketConfig [DiscordSocketConfig]: xref:Discord.WebSocket.DiscordSocketConfig


***

### Configuring NuGet without Visual Studio ### Configuring NuGet without Visual Studio


If you plan on deploying your bot or developing outside of Visual If you plan on deploying your bot or developing outside of Visual
@@ -170,3 +187,5 @@ Paste the following snippets into this configuration file, adding any
additional feeds if necessary. additional feeds if necessary.


[!code[NuGet Configuration](samples/nuget.config)] [!code[NuGet Configuration](samples/nuget.config)]

[.NET Core SDK]: https://www.microsoft.com/net/download/

+ 2
- 2
docs/guides/getting_started/samples/project.xml View File

@@ -6,11 +6,11 @@
--> -->
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup> </PropertyGroup>


<ItemGroup> <ItemGroup>
<PackageReference Include="Discord.Net" Version="2.*" />
<PackageReference Include="Discord.Net" Version="2.0.0" />
</ItemGroup> </ItemGroup>


</Project> </Project>

Loading…
Cancel
Save