azure-pipelines.yml, run-tests-on-os.yml: Added tests for .NET 5
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index d01df3f..7a1808b 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -102,7 +102,7 @@
     steps:
     
     - checkout: self # self represents the repo where the initial Pipelines YAML file was found
-      fetchDepth: 1  # the depth of commits to ask Git to fetch
+      fetchDepth: '1'  # the depth of commits to ask Git to fetch
 
     - powershell: |
         $configuration = if ($env:BUILDCONFIGURATION) { $env:BUILDCONFIGURATION } else { "Release" }
@@ -110,9 +110,9 @@
       displayName: 'Setup Default Variable Values'
 
     - task: UseDotNet@2
-      displayName: 'Use .NET Core sdk 3.1.301'
+      displayName: 'Use .NET Core sdk 5.0.100'
       inputs:
-        version: 3.1.301
+        version: 5.0.100
 
     - powershell: |
         Import-Module "$(BuildDirectory)/psake.psm1"
@@ -205,6 +205,13 @@
     - template: 'build/azure-templates/publish-test-binaries.yml'
       parameters:
         publishDirectory: $(PublishTempDirectory)
+        framework: 'net5.0'
+        binaryArtifactName: '$(BinaryArtifactName)'
+        testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
+
+    - template: 'build/azure-templates/publish-test-binaries.yml'
+      parameters:
+        publishDirectory: $(PublishTempDirectory)
         framework: 'netcoreapp3.1'
         binaryArtifactName: '$(BinaryArtifactName)'
         testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
@@ -246,8 +253,8 @@
     - powershell: |
          $(Build.SourcesDirectory)/websites/apidocs/docs.ps1 -LuceneNetVersion $(PackageVersion) -Clean -BaseUrl https://lucenenet.apache.org/docs/
       errorActionPreference: 'continue'
-      ignoreLASTEXITCODE: true
-      failOnStderr: false
+      ignoreLASTEXITCODE: 'true'
+      failOnStderr: 'false'
       displayName: 'Generate Documentation'
 
     - task: ArchiveFiles@2
@@ -272,8 +279,8 @@
     - powershell: |
          $(Build.SourcesDirectory)/websites/site/site.ps1 0 1
       errorActionPreference: 'continue'
-      ignoreLASTEXITCODE: true
-      failOnStderr: false
+      ignoreLASTEXITCODE: 'true'
+      failOnStderr: 'false'
       displayName: 'Generate Website'
 
     - task: ArchiveFiles@2
@@ -293,6 +300,71 @@
 - stage: Test_Stage
   displayName: 'Test Stage:'
   jobs:
+
+  - job: Test_net5_0_x64
+    condition: and(succeeded(), ne(variables['RunTests'], 'false'))
+    strategy:
+      matrix:
+        Windows:
+          osName: 'Windows'
+          imageName: 'windows-2019'
+          maximumParallelJobs: 8
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+        Linux:
+          osName: 'Linux'
+          imageName: 'ubuntu-16.04'
+          maximumParallelJobs: 7
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+        macOS:
+          osName: 'macOS'
+          imageName: 'macOS-10.14'
+          maximumParallelJobs: 7
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+    displayName: 'Test net5.0,x64 on'
+    pool:
+      vmImage: $(imageName)
+    steps:
+    - template: 'build/azure-templates/run-tests-on-os.yml'
+      parameters:
+        osName: $(osName)
+        framework: 'net5.0'
+        vsTestPlatform: 'x64'
+        testResultsArtifactName: '$(TestResultsArtifactName)'
+        maximumParallelJobs: $(maximumParallelJobs)
+        maximumAllowedFailures: $(maximumAllowedFailures)
+
+  - job: Test_net5_0_x86 # Only run Nightly
+    condition: and(succeeded(), ne(variables['RunTests'], 'false'), eq(variables['IsNightly'], 'true'))
+    strategy:
+      matrix:
+        Windows:
+          osName: 'Windows'
+          imageName: 'windows-2019'
+          maximumParallelJobs: 8
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+        Linux:
+          osName: 'Linux'
+          imageName: 'ubuntu-16.04'
+          maximumParallelJobs: 7
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+        macOS:
+          osName: 'macOS'
+          imageName: 'macOS-10.14'
+          maximumParallelJobs: 7
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+    displayName: 'Test net5.0,x86 on'
+    pool:
+      vmImage: $(imageName)
+    steps:
+    - template: 'build/azure-templates/run-tests-on-os.yml'
+      parameters:
+        osName: $(osName)
+        framework: 'net5.0'
+        vsTestPlatform: 'x86'
+        testResultsArtifactName: '$(TestResultsArtifactName)'
+        maximumParallelJobs: $(maximumParallelJobs)
+        maximumAllowedFailures: $(maximumAllowedFailures)
+
   - job: Test_netcoreapp3_1_x64
     condition: and(succeeded(), ne(variables['RunTests'], 'false'))
     strategy:
@@ -466,7 +538,7 @@
     steps:
       # We checkout here because we need to publish the source code along with the symbols for debugging
     - checkout: self # self represents the repo where the initial Pipelines YAML file was found
-      fetchDepth: 1  # the depth of commits to ask Git to fetch
+      fetchDepth: '1'  # the depth of commits to ask Git to fetch
 
     - template: 'build/azure-templates/show-all-environment-variables.yml'
 
@@ -509,12 +581,12 @@
     steps:
     # We checkout here because we need to publish the source code along with the binaries per Apache's releae policy
     - checkout: self # self represents the repo where the initial Pipelines YAML file was found
-      fetchDepth: 1  # the depth of commits to ask Git to fetch
+      fetchDepth: '1'  # the depth of commits to ask Git to fetch
 
     - template: 'build/azure-templates/show-all-environment-variables.yml'
 
 
-    - task: DownloadPipelineArtifact@0
+    - task: 'DownloadPipelineArtifact@0'
       displayName: 'Download Build Artifacts: $(NuGetArtifactName)'
       inputs:
         artifactName: '$(NuGetArtifactName)'
diff --git a/build/azure-templates/run-tests-on-os.yml b/build/azure-templates/run-tests-on-os.yml
index b949853..97c391a 100644
--- a/build/azure-templates/run-tests-on-os.yml
+++ b/build/azure-templates/run-tests-on-os.yml
@@ -61,6 +61,13 @@
 
 - powershell: | 
     Get-ChildItem -Path $(System.DefaultWorkingDirectory)
+
+- task: UseDotNet@2
+  displayName: 'Use .NET sdk 5.0.100'
+  inputs:
+    version: 5.0.100
+  condition: and(succeeded(), contains('${{ parameters.framework }}', 'net5.'))
+
 - task: UseDotNet@2
   displayName: 'Use .NET Core sdk 3.1.301'
   inputs:
@@ -92,12 +99,12 @@
     
     # Convert $framework (i.e. net461) into format for dotnet vstest (i.e. .NETFramework,Version=4.6.1)
     function ConvertFrameworkName([string]$framework) {
-        $match = [regex]::Match($framework, '^net(\d+)$') # .NET Framework
+        $match = [regex]::Match($framework, '^net(4\d+)$') # .NET Framework 4+
         if ($match.Success) {
             $ver = SeparateVersionDigits($match.Groups[1].Value)
             return ".NETFramework,Version=v$($ver)"
         }
-        $match = [regex]::Match($framework, '^netcoreapp(\d+\.\d+(?:\.\d+)?)$') # .NET Core
+        $match = [regex]::Match($framework, '^net(?:coreapp)?(\d+\.\d+(?:\.\d+)?)$') # .NET 5 / .NET Core
         if ($match.Success) {
             $ver = $match.Groups[1].Value
             return ".NETCoreApp,Version=v$($ver)"
@@ -115,7 +122,7 @@
         if ($IsWindows -eq $null) {
             $IsWindows = $env:OS.StartsWith('Win')
         }
-        if (!$IsWindows -and !$framework.StartsWith('netcoreapp')) {
+        if (!$IsWindows -and $framework.StartsWith('net4')) {
             return $false
         }
         return $true