Skip to content

Commit 0ed342a

Browse files
authored
Merge pull request #99 from MicrosoftDocs/blue-green-21q4r
Update for .NET 5.0 and Ubuntu 20.04
2 parents 00fbf64 + af9deff commit 0ed342a

File tree

10 files changed

+126
-62
lines changed

10 files changed

+126
-62
lines changed

.vscode/launch.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
// Use IntelliSense to find out which attributes exist for C# debugging
6+
// Use hover for the description of the existing attributes
7+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8+
"name": ".NET Core Launch (web)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/Tailspin.SpaceGame.Web/bin/Debug/net5.0/Tailspin.SpaceGame.Web.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}/Tailspin.SpaceGame.Web",
16+
"stopAtEntry": false,
17+
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
18+
"serverReadyAction": {
19+
"action": "openExternally",
20+
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
21+
},
22+
"env": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"sourceFileMap": {
26+
"/Views": "${workspaceFolder}/Views"
27+
}
28+
},
29+
{
30+
"name": ".NET Core Attach",
31+
"type": "coreclr",
32+
"request": "attach",
33+
"processId": "${command:pickProcess}"
34+
}
35+
]
36+
}

.vscode/tasks.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.csproj",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"${workspaceFolder}/Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.csproj",
36+
"/property:GenerateFullPaths=true",
37+
"/consoleloggerparameters:NoSummary"
38+
],
39+
"problemMatcher": "$msCompile"
40+
}
41+
]
42+
}

Tailspin.SpaceGame.Web/LocalDocumentDBRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Linq;
55
using System.Linq.Expressions;
66
using System.Threading.Tasks;
7-
using Newtonsoft.Json;
7+
using System.Text.Json;
88
using TailSpin.SpaceGame.Web.Models;
99

1010
namespace TailSpin.SpaceGame.Web
@@ -17,7 +17,7 @@ public class LocalDocumentDBRepository<T> : IDocumentDBRepository<T> where T : M
1717
public LocalDocumentDBRepository(string fileName)
1818
{
1919
// Serialize the items from the provided JSON document.
20-
_items = JsonConvert.DeserializeObject<List<T>>(File.ReadAllText(fileName));
20+
_items = JsonSerializer.Deserialize<List<T>>(File.ReadAllText(fileName));
2121
}
2222

2323
/// <summary>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Newtonsoft.Json;
1+
using System.Text.Json.Serialization;
22

33
namespace TailSpin.SpaceGame.Web.Models
44
{
@@ -8,7 +8,7 @@ namespace TailSpin.SpaceGame.Web.Models
88
public abstract class Model
99
{
1010
// The value that uniquely identifies this object.
11-
[JsonProperty(PropertyName = "id")]
11+
[JsonPropertyName("id")]
1212
public string Id { get; set; }
1313
}
1414
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
using Newtonsoft.Json;
1+
using System.Text.Json.Serialization;
22

33
namespace TailSpin.SpaceGame.Web.Models
44
{
55
public class Profile : Model
66
{
77
// The player's user name.
8-
[JsonProperty(PropertyName = "userName")]
8+
[JsonPropertyName("userName")]
99
public string UserName { get; set; }
1010

1111
// The URL of the player's avatar image.
12-
[JsonProperty(PropertyName = "avatarUrl")]
12+
[JsonPropertyName("avatarUrl")]
1313
public string AvatarUrl { get; set; }
1414

1515
// The achievements the player earned.
16-
[JsonProperty(PropertyName = "achievements")]
16+
[JsonPropertyName("achievements")]
1717
public string[] Achievements { get; set; }
1818
}
1919
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
using Newtonsoft.Json;
1+
using System.Text.Json.Serialization;
22

33
namespace TailSpin.SpaceGame.Web.Models
44
{
55
public class Score : Model
66
{
77
// The ID of the player profile associated with this score.
8-
[JsonProperty(PropertyName = "profileId")]
8+
[JsonPropertyName("profileId")]
99
public string ProfileId { get; set; }
1010

1111
// The score value.
12-
[JsonProperty(PropertyName = "score")]
12+
[JsonPropertyName("score")]
1313
public int HighScore { get; set; }
1414

1515
// The game mode the score is associated with.
16-
[JsonProperty(PropertyName = "gameMode")]
16+
[JsonPropertyName("gameMode")]
1717
public string GameMode { get; set; }
1818

1919
// The game region (map) the score is associated with.
20-
[JsonProperty(PropertyName = "gameRegion")]
20+
[JsonPropertyName("gameRegion")]
2121
public string GameRegion { get; set; }
2222
}
2323
}

Tailspin.SpaceGame.Web/Startup.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
using Microsoft.AspNetCore.Builder;
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Builder;
26
using Microsoft.AspNetCore.Hosting;
3-
using Microsoft.AspNetCore.Http;
47
using Microsoft.AspNetCore.HttpsPolicy;
58
using Microsoft.Extensions.Configuration;
69
using Microsoft.Extensions.DependencyInjection;
710
using Microsoft.Extensions.Hosting;
8-
using System;
9-
using System.Collections.Generic;
10-
using System.Linq;
11-
using System.Threading.Tasks;
1211
using TailSpin.SpaceGame.Web.Models;
12+
using Microsoft.AspNetCore.Http;
13+
1314

1415
namespace TailSpin.SpaceGame.Web
1516
{
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<ProjectGuid>{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}</ProjectGuid>
66
</PropertyGroup>
77

8-
<ItemGroup>
9-
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
10-
</ItemGroup>
11-
128
<ItemGroup>
139
<Folder Include="wwwroot\images\avatars\" />
1410
</ItemGroup>
15-
</Project>
11+
</Project>

azure-pipelines.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ stages:
1111
- job: 'Build'
1212
displayName: 'Build job'
1313
pool:
14-
vmImage: 'ubuntu-18.04'
14+
vmImage: 'ubuntu-20.04'
1515
demands:
1616
- npm
1717

1818
variables:
1919
wwwrootDir: 'Tailspin.SpaceGame.Web/wwwroot'
20-
dotnetSdkVersion: '3.1.300'
20+
dotnetSdkVersion: '5.x'
2121

2222
steps:
2323
- task: UseDotNet@2
24-
displayName: 'Use .NET Core SDK $(dotnetSdkVersion)'
24+
displayName: 'Use .NET SDK $(dotnetSdkVersion)'
2525
inputs:
2626
version: '$(dotnetSdkVersion)'
2727

@@ -71,7 +71,7 @@ stages:
7171
jobs:
7272
- deployment: Deploy
7373
pool:
74-
vmImage: 'ubuntu-18.04'
74+
vmImage: 'ubuntu-20.04'
7575
environment: dev
7676
variables:
7777
- group: Release
@@ -94,7 +94,7 @@ stages:
9494
jobs:
9595
- deployment: Deploy
9696
pool:
97-
vmImage: 'ubuntu-18.04'
97+
vmImage: 'ubuntu-20.04'
9898
environment: test
9999
variables:
100100
- group: 'Release'
@@ -117,7 +117,7 @@ stages:
117117
jobs:
118118
- deployment: Deploy
119119
pool:
120-
vmImage: 'ubuntu-18.04'
120+
vmImage: 'ubuntu-20.04'
121121
environment: staging
122122
variables:
123123
- group: 'Release'

package-lock.json

Lines changed: 20 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)