diff --git a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj
index 9b45fb61b7e..dbb5365a805 100644
--- a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj
+++ b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj
@@ -43,7 +43,7 @@
TargetFramework=$(FullFrameworkTFM)
TargetFramework=$(FullFrameworkTFM)
- TargetFramework=netcoreapp2.1
+ TargetFramework=net5.0
diff --git a/src/Build/BackEnd/Components/ProjectCache/ProjectCacheItem.cs b/src/Build/BackEnd/Components/ProjectCache/ProjectCacheItem.cs
index 21af5dd54ed..b1d781b1ca2 100644
--- a/src/Build/BackEnd/Components/ProjectCache/ProjectCacheItem.cs
+++ b/src/Build/BackEnd/Components/ProjectCache/ProjectCacheItem.cs
@@ -26,25 +26,25 @@ public ProjectCacheItem(string pluginPath, IReadOnlyDictionary p
public string PluginPath { get; }
public IReadOnlyDictionary PluginSettings { get; }
- public bool Equals(ProjectCacheItem other)
+ public bool Equals(ProjectCacheItem? other)
{
if (ReferenceEquals(this, other))
{
return true;
}
- return PluginPath == other.PluginPath &&
+ return PluginPath == other?.PluginPath &&
CollectionHelpers.DictionaryEquals(PluginSettings, other.PluginSettings);
}
- public override bool Equals(object obj)
+ public override bool Equals(object? obj)
{
if (ReferenceEquals(this, obj))
{
return true;
}
- if (obj.GetType() != GetType())
+ if (obj?.GetType() != GetType())
{
return false;
}
diff --git a/src/Build/BackEnd/Components/ProjectCache/ProjectCacheService.cs b/src/Build/BackEnd/Components/ProjectCache/ProjectCacheService.cs
index 340d613c1c3..3103b05ddf6 100644
--- a/src/Build/BackEnd/Components/ProjectCache/ProjectCacheService.cs
+++ b/src/Build/BackEnd/Components/ProjectCache/ProjectCacheService.cs
@@ -92,7 +92,7 @@ private static ProjectCachePluginBase GetPluginInstanceFromType(Type pluginType)
{
try
{
- return (ProjectCachePluginBase) Activator.CreateInstance(pluginType);
+ return (ProjectCachePluginBase) Activator.CreateInstance(pluginType)!;
}
catch (TargetInvocationException e) when (e.InnerException != null)
{
diff --git a/src/Samples/ProjectCachePlugin/ProjectCachePlugin.csproj b/src/Samples/ProjectCachePlugin/ProjectCachePlugin.csproj
index 9e1faa4fdbf..df35ae1ca6b 100644
--- a/src/Samples/ProjectCachePlugin/ProjectCachePlugin.csproj
+++ b/src/Samples/ProjectCachePlugin/ProjectCachePlugin.csproj
@@ -4,8 +4,8 @@
false
false
- netcoreapp2.1
- $(FullFrameworkTFM);netcoreapp2.1
+ net5.0
+ $(FullFrameworkTFM);net5.0
$(RuntimeOutputTargetFrameworks)