Skip to content

Commit 9b31e8d

Browse files
authored
Update the guide to target .NET 5 (#22297)
1 parent 67f3a58 commit 9b31e8d

File tree

11 files changed

+22
-19
lines changed

11 files changed

+22
-19
lines changed

docs/core/tutorials/creating-app-with-plugin-support.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ This tutorial shows you how to create a custom <xref:System.Runtime.Loader.Assem
1717

1818
## Prerequisites
1919

20-
- Install the [.NET Core 3.0 SDK](https://dotnet.microsoft.com/download) or a newer version.
20+
- Install the [.NET 5 SDK](https://dotnet.microsoft.com/download) or a newer version.
21+
22+
> [!NOTE]
23+
> The sample code targets .NET 5, but all the features it uses were introduced in .NET Core 3.0 and are available in all .NET releases since then.
2124
2225
## Create the application
2326

@@ -234,7 +237,7 @@ Now, open the *HelloPlugin.csproj* file. It should look similar to the following
234237
<Project Sdk="Microsoft.NET.Sdk">
235238
236239
<PropertyGroup>
237-
<TargetFramework>netcoreapp3.0</TargetFramework>
240+
<TargetFramework>net5</TargetFramework>
238241
</PropertyGroup>
239242
240243
</Project>
@@ -282,7 +285,7 @@ This prevents the `A.PluginBase` assemblies from being copied to the output dire
282285

283286
## Plugin target framework recommendations
284287

285-
Because plugin dependency loading uses the *.deps.json* file, there is a gotcha related to the plugin's target framework. Specifically, your plugins should target a runtime, such as .NET Core 3.0, instead of a version of .NET Standard. The *.deps.json* file is generated based on which framework the project targets, and since many .NET Standard-compatible packages ship reference assemblies for building against .NET Standard and implementation assemblies for specific runtimes, the *.deps.json* may not correctly see implementation assemblies, or it may grab the .NET Standard version of an assembly instead of the .NET Core version you expect.
288+
Because plugin dependency loading uses the *.deps.json* file, there is a gotcha related to the plugin's target framework. Specifically, your plugins should target a runtime, such as .NET 5, instead of a version of .NET Standard. The *.deps.json* file is generated based on which framework the project targets, and since many .NET Standard-compatible packages ship reference assemblies for building against .NET Standard and implementation assemblies for specific runtimes, the *.deps.json* may not correctly see implementation assemblies, or it may grab the .NET Standard version of an assembly instead of the .NET Core version you expect.
286289

287290
## Plugin framework references
288291

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/AppWithPlugin/AppWithPlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<TargetFramework>net5</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/AppWithPlugin/Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ static void Main(string[] args)
2121

2222
string[] pluginPaths = new string[]
2323
{
24-
@"HelloPlugin\bin\Debug\netcoreapp3.0\HelloPlugin.dll",
25-
@"JsonPlugin\bin\Debug\netcoreapp3.0\JsonPlugin.dll",
26-
@"XcopyablePlugin\bin\Debug\netcoreapp3.0\XcopyablePlugin.dll",
27-
@"OldJsonPlugin\bin\Debug\netcoreapp2.1\OldJsonPlugin.dll",
28-
@"FrenchPlugin\bin\Debug\netcoreapp2.1\FrenchPlugin.dll",
29-
@"UVPlugin\bin\Debug\netcoreapp2.1\UVPlugin.dll",
24+
@"HelloPlugin\bin\Debug\net5\HelloPlugin.dll",
25+
@"JsonPlugin\bin\Debug\net5\JsonPlugin.dll",
26+
@"XcopyablePlugin\bin\Debug\net5\XcopyablePlugin.dll",
27+
@"OldJsonPlugin\bin\Debug\net5\OldJsonPlugin.dll",
28+
@"FrenchPlugin\bin\Debug\net5\FrenchPlugin.dll",
29+
@"UVPlugin\bin\Debug\net5\UVPlugin.dll",
3030
};
3131

3232
IEnumerable<ICommand> commands = pluginPaths.SelectMany(pluginPath =>

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/FrenchPlugin/FrenchPlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/HelloPlugin/HelloPlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/JsonPlugin/JsonPlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/OldJsonPlugin/OldJsonPlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5</TargetFramework>
55
</PropertyGroup>
66

77
</Project>

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ By using `AssemblyDependencyResolver` along with a custom `AssemblyLoadContext`,
1010

1111
## Build and Run
1212

13-
1. Install .NET Core 3.0 Preview 2 or newer.
14-
2. Use the .NET Core SDK to build the project via `dotnet build`.
13+
1. Install .NET 5 or newer. The sample targets .NET 5, but support for all the features it uses was added in .NET Core 3.0.
14+
2. Use the .NET SDK to build the project via `dotnet build`.
1515
- The AppWithPlugin project does not contain any references to the plugin projects, so you need to build the solution.
1616
3. Go to the AppWithPlugin directory and use `dotnet run` to run the app.
1717
- You should see the app output a list of installed commands.

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/UVPlugin/UVPlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

samples/snippets/core/tutorials/creating-app-with-plugin-support/csharp/XcopyablePlugin/XcopyablePlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5</TargetFramework>
55
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
66
</PropertyGroup>
77

0 commit comments

Comments
 (0)