Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade package framework to .NET Core 3.1 and 2.1 #182

Merged
merged 1 commit into from
Jan 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
cleanup: upgrade package to .NET Core 3.1 or 2.1
  • Loading branch information
natemcmaster committed Jan 31, 2021
commit 52137c23886eaeaa94bd3805db83afb4bf79c826
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>1.3.1</VersionPrefix>
<VersionPrefix>1.4.0</VersionPrefix>
<VersionSuffix>beta</VersionSuffix>
<IncludePreReleaseLabelInPackageVersion Condition="'$(IsStableBuild)' != 'true'">true</IncludePreReleaseLabelInPackageVersion>
<BuildNumber Condition=" '$(BuildNumber)' == '' ">$([MSBuild]::ValueOrDefault($(BUILD_NUMBER), 0))</BuildNumber>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ There is nothing special about the name "IPlugin" or the fact that it's an inter

### The plugins

Typically, it is best to implement plugins by targeting `netcoreapp2.0` or higher. They can target `netstandard2.0` as well, but using `netcoreapp2.0` is better because it reduces the number of redundant System.\* assemblies in the plugin output.
Typically, it is best to implement plugins by targeting `net5.0` or higher. They can target `netstandard2.0` as well, but using `net5.0` is better because it reduces the number of redundant System.\* assemblies in the plugin output.

A minimal implementation of the plugin could be as simple as this.

Expand Down
4 changes: 2 additions & 2 deletions src/Plugins.Mvc/McMaster.NETCore.Plugins.Mvc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
<OutputType>library</OutputType>
<IsPackable>true</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -21,7 +21,7 @@ See https://github.com/natemcmaster/DotNetCorePlugins/blob/master/README.md for
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

Expand Down
12 changes: 6 additions & 6 deletions src/Plugins/McMaster.NETCore.Plugins.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
<!--
The netcoreapp2.0 API is a subset of the API available in netcoreapp3.0. The public API tool doesn't handle multiple TFMs.
The netcoreapp2.1 API is a subset of the API available in netcoreapp3.1. The public API tool doesn't handle multiple TFMs.
https://github.com/dotnet/roslyn-analyzers/issues/2621
-->
<DisablePublicApiAnalyzer Condition="'$(TargetFramework)' == 'netcoreapp2.0'">true</DisablePublicApiAnalyzer>
<DisablePublicApiAnalyzer Condition="'$(TargetFramework)' == 'netcoreapp2.1'">true</DisablePublicApiAnalyzer>
<OutputType>library</OutputType>
<IsPackable>true</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -16,14 +16,14 @@ This package should be used by the host application which needs to load plugins.
See https://github.com/natemcmaster/DotNetCorePlugins/blob/master/README.md for more samples and documentation.
</PackageDescription>
<PackageTags>.NET Core;plugins</PackageTags>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.0'">$(DefineConstants);FEATURE_UNLOAD</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.0'">$(DefineConstants);FEATURE_NATIVE_RESOLVER</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.1'">$(DefineConstants);FEATURE_UNLOAD</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.1'">$(DefineConstants);FEATURE_NATIVE_RESOLVER</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="5.0.1" Condition="'$(TargetFramework)' == 'netcoreapp2.0'" />
<PackageReference Include="System.Text.Json" Version="5.0.1" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Plugins/PluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public Assembly LoadAssembly(string assemblyName)
return LoadAssembly(new AssemblyName(assemblyName));
}

#if NETCOREAPP3_0
#if !NETCOREAPP2_1
/// <summary>
/// Sets the scope used by some System.Reflection APIs which might trigger assembly loading.
/// <para>
Expand Down
2 changes: 1 addition & 1 deletion test/TestProjects/Banana/Banana.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</ItemGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion test/TestProjects/DrawingApp/DrawingApp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/TestProjects/Plátano/Plátano.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</ItemGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>