Skip to content

Commit bed7cfa

Browse files
authored
Merge pull request #465 from microsoftgraph/dotnet10
Update to .NET 10
2 parents b198d0e + 55eeaff commit bed7cfa

File tree

11 files changed

+66
-60
lines changed

11 files changed

+66
-60
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ insert_final_newline = true
66
[*.{cs,cshtml}]
77
indent_size = 4
88
dotnet_diagnostic.SA1101.severity = silent
9+
dotnet_diagnostic.SA1512.severity = silent
910
dotnet_diagnostic.SA1513.severity = silent
11+
dotnet_diagnostic.SA1515.severity = silent
1012
dotnet_diagnostic.SA1600.severity = silent
1113
dotnet_diagnostic.CS1591.severity = silent

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup .NET
1717
uses: actions/setup-dotnet@v5
1818
with:
19-
dotnet-version: 9.x
19+
dotnet-version: 10.x
2020
- name: Restore dependencies
2121
working-directory: user-auth/GraphTutorial/
2222
run: dotnet restore

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"request": "launch",
1111
"preLaunchTask": "build user-auth",
1212
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceFolder}/user-auth/GraphTutorial/bin/Debug/net9.0/GraphTutorial.dll",
13+
"program": "${workspaceFolder}/user-auth/GraphTutorial/bin/Debug/net10.0/GraphTutorial.dll",
1414
"args": [],
1515
"cwd": "${workspaceFolder}/user-auth/GraphTutorial",
1616
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
@@ -26,7 +26,7 @@
2626
"request": "launch",
2727
"preLaunchTask": "build app-auth",
2828
// If you have changed target frameworks, make sure to update the program path.
29-
"program": "${workspaceFolder}/app-auth/GraphAppOnlyTutorial/bin/Debug/net9.0/GraphAppOnlyTutorial.dll",
29+
"program": "${workspaceFolder}/app-auth/GraphAppOnlyTutorial/bin/Debug/net10.0/GraphAppOnlyTutorial.dll",
3030
"args": [],
3131
"cwd": "${workspaceFolder}/app-auth/GraphAppOnlyTutorial",
3232
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console

app-auth/GraphAppOnlyTutorial/GraphAppOnlyTutorial.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<!-- cSpell:ignore stylecop contentfiles buildtransitive -->
3+
<!-- cSpell:ignore stylecop contentfiles buildtransitive appsettings -->
44

55
<PropertyGroup>
66
<OutputType>Exe</OutputType>
7-
<TargetFramework>net9.0</TargetFramework>
7+
<TargetFramework>net10.0</TargetFramework>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
1010
<UserSecretsId>2275df63-2eb2-47b9-a11f-710535686d4b</UserSecretsId>
@@ -23,9 +23,9 @@
2323

2424
<ItemGroup>
2525
<PackageReference Include="Azure.Identity" Version="1.17.1" />
26-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.10" />
27-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.10" />
28-
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.10" />
26+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.0" />
27+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
28+
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0" />
2929
<PackageReference Include="Microsoft.Graph" Version="5.97.0" />
3030
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
3131
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

app-auth/GraphAppOnlyTutorial/GraphHelper.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace GraphAppOnlyTutorial;
1010

1111
public class GraphHelper
1212
{
13-
/* <AppOnlyAuthConfigSnippet> */
13+
// <AppOnlyAuthConfigSnippet>
1414
// Settings object
1515
private static Settings? settings;
1616

@@ -39,9 +39,9 @@ public static void InitializeGraphForAppOnlyAuth(Settings settings)
3939
configured on the app registration */
4040
["https://graph.microsoft.com/.default"]);
4141
}
42-
/* </AppOnlyAuthConfigSnippet> */
42+
// </AppOnlyAuthConfigSnippet>
4343

44-
/* <GetAppOnlyTokenSnippet> */
44+
// <GetAppOnlyTokenSnippet>
4545
public static async Task<string> GetAppOnlyTokenAsync()
4646
{
4747
// Ensure credential isn't null
@@ -53,9 +53,9 @@ public static async Task<string> GetAppOnlyTokenAsync()
5353
var response = await clientSecretCredential.GetTokenAsync(context);
5454
return response.Token;
5555
}
56-
/* </GetAppOnlyTokenSnippet> */
56+
// </GetAppOnlyTokenSnippet>
5757

58-
/* <GetUsersSnippet> */
58+
// <GetUsersSnippet>
5959
public static Task<UserCollectionResponse?> GetUsersAsync()
6060
{
6161
// Ensure client isn't null
@@ -72,15 +72,15 @@ public static async Task<string> GetAppOnlyTokenAsync()
7272
config.QueryParameters.Orderby = ["displayName"];
7373
});
7474
}
75-
/* </GetUsersSnippet> */
75+
// </GetUsersSnippet>
7676

7777
#pragma warning disable CS1998
78-
/* <MakeGraphCallSnippet> */
78+
// <MakeGraphCallSnippet>
7979
/* This function serves as a playground for testing Graph snippets
8080
or other code */
8181
public static async Task MakeGraphCallAsync()
8282
{
8383
// INSERT YOUR CODE HERE
8484
}
85-
/* </MakeGraphCallSnippet> */
85+
// </MakeGraphCallSnippet>
8686
}

app-auth/GraphAppOnlyTutorial/Program.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
/* <ProgramSnippet> */
4+
// <ProgramSnippet>
55
using GraphAppOnlyTutorial;
66

77
Console.WriteLine(".NET Graph App-only Tutorial\n");
@@ -54,16 +54,16 @@
5454
break;
5555
}
5656
}
57-
/* </ProgramSnippet> */
57+
// </ProgramSnippet>
5858

59-
/* <InitializeGraphSnippet> */
59+
// <InitializeGraphSnippet>
6060
void InitializeGraph(Settings settings)
6161
{
6262
GraphHelper.InitializeGraphForAppOnlyAuth(settings);
6363
}
64-
/* </InitializeGraphSnippet> */
64+
// </InitializeGraphSnippet>
6565

66-
/* <DisplayAccessTokenSnippet> */
66+
// <DisplayAccessTokenSnippet>
6767
async Task DisplayAccessTokenAsync()
6868
{
6969
try
@@ -76,9 +76,9 @@ async Task DisplayAccessTokenAsync()
7676
Console.WriteLine($"Error getting app-only access token: {ex.Message}");
7777
}
7878
}
79-
/* </DisplayAccessTokenSnippet> */
79+
// </DisplayAccessTokenSnippet>
8080

81-
/* <ListUsersSnippet> */
81+
// <ListUsersSnippet>
8282
async Task ListUsersAsync()
8383
{
8484
try
@@ -113,11 +113,11 @@ async Task ListUsersAsync()
113113
Console.WriteLine($"Error getting users: {ex.Message}");
114114
}
115115
}
116-
/* </ListUsersSnippet> */
116+
// </ListUsersSnippet>
117117

118-
/* <MakeGraphCallSnippet> */
118+
// <MakeGraphCallSnippet>
119119
async Task MakeGraphCallAsync()
120120
{
121121
await GraphHelper.MakeGraphCallAsync();
122122
}
123-
/* </MakeGraphCallSnippet> */
123+
// </MakeGraphCallSnippet>

app-auth/GraphAppOnlyTutorial/Settings.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4+
// cSpell:ignore appsettings
5+
46
/* <SettingsSnippet> */
57
using Microsoft.Extensions.Configuration;
68

@@ -30,4 +32,4 @@ public static Settings LoadSettings()
3032
throw new Exception("Could not load app settings. See README for configuration instructions.");
3133
}
3234
}
33-
/* </SettingsSnippet> */
35+
// </SettingsSnippet>

user-auth/GraphTutorial/GraphHelper.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace GraphTutorial;
1111

1212
public class GraphHelper
1313
{
14-
/* <UserAuthConfigSnippet> */
14+
// <UserAuthConfigSnippet>
1515
// Settings object
1616
private static Settings? settings;
1717

@@ -38,9 +38,9 @@ public static void InitializeGraphForUserAuth(
3838

3939
userClient = new GraphServiceClient(deviceCodeCredential, settings.GraphUserScopes);
4040
}
41-
/* </UserAuthConfigSnippet> */
41+
// </UserAuthConfigSnippet>
4242

43-
/* <GetUserTokenSnippet> */
43+
// <GetUserTokenSnippet>
4444
public static async Task<string> GetUserTokenAsync()
4545
{
4646
// Ensure credential isn't null
@@ -55,9 +55,9 @@ public static async Task<string> GetUserTokenAsync()
5555
var response = await deviceCodeCredential.GetTokenAsync(context);
5656
return response.Token;
5757
}
58-
/* </GetUserTokenSnippet> */
58+
// </GetUserTokenSnippet>
5959

60-
/* <GetUserSnippet> */
60+
// <GetUserSnippet>
6161
public static Task<User?> GetUserAsync()
6262
{
6363
// Ensure client isn't null
@@ -70,9 +70,9 @@ public static async Task<string> GetUserTokenAsync()
7070
config.QueryParameters.Select = ["displayName", "mail", "userPrincipalName"];
7171
});
7272
}
73-
/* </GetUserSnippet> */
73+
// </GetUserSnippet>
7474

75-
/* <GetInboxSnippet> */
75+
// <GetInboxSnippet>
7676
public static Task<MessageCollectionResponse?> GetInboxAsync()
7777
{
7878
// Ensure client isn't null
@@ -92,9 +92,9 @@ public static async Task<string> GetUserTokenAsync()
9292
config.QueryParameters.Orderby = ["receivedDateTime DESC"];
9393
});
9494
}
95-
/* </GetInboxSnippet> */
95+
// </GetInboxSnippet>
9696

97-
/* <SendMailSnippet> */
97+
// <SendMailSnippet>
9898
public static async Task SendMailAsync(string subject, string body, string recipient)
9999
{
100100
// Ensure client isn't null
@@ -130,15 +130,15 @@ await userClient.Me
130130
Message = message,
131131
});
132132
}
133-
/* </SendMailSnippet> */
133+
// </SendMailSnippet>
134134

135135
#pragma warning disable CS1998
136-
/* <MakeGraphCallSnippet> */
136+
// <MakeGraphCallSnippet>
137137
/* This function serves as a playground for testing Graph snippets */
138138
/* or other code */
139139
public static async Task MakeGraphCallAsync()
140140
{
141141
// INSERT YOUR CODE HERE
142142
}
143-
/* </MakeGraphCallSnippet> */
143+
// </MakeGraphCallSnippet>
144144
}

user-auth/GraphTutorial/GraphTutorial.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<!-- cSpell:ignore stylecop contentfiles buildtransitive -->
3+
<!-- cSpell:ignore stylecop contentfiles buildtransitive appsettings -->
44
<PropertyGroup>
55
<OutputType>Exe</OutputType>
6-
<TargetFramework>net9.0</TargetFramework>
6+
<TargetFramework>net10.0</TargetFramework>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
<UserSecretsId>2275df63-2eb2-47b9-a11f-710535686d4b</UserSecretsId>
@@ -22,9 +22,9 @@
2222

2323
<ItemGroup>
2424
<PackageReference Include="Azure.Identity" Version="1.17.1" />
25-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.10" />
26-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.10" />
27-
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.10" />
25+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.0" />
26+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
27+
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0" />
2828
<PackageReference Include="Microsoft.Graph" Version="5.97.0" />
2929
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
3030
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

user-auth/GraphTutorial/Program.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
/* <ProgramSnippet> */
4+
// <ProgramSnippet>
55
using GraphTutorial;
66

77
Console.WriteLine(".NET Graph Tutorial\n");
@@ -62,9 +62,9 @@
6262
break;
6363
}
6464
}
65-
/* </ProgramSnippet> */
65+
// </ProgramSnippet>
6666

67-
/* <InitializeGraphSnippet> */
67+
// <InitializeGraphSnippet>
6868
void InitializeGraph(Settings settings)
6969
{
7070
GraphHelper.InitializeGraphForUserAuth(
@@ -79,9 +79,9 @@ void InitializeGraph(Settings settings)
7979
return Task.FromResult(0);
8080
});
8181
}
82-
/* </InitializeGraphSnippet> */
82+
// </InitializeGraphSnippet>
8383

84-
/* <GreetUserSnippet> */
84+
// <GreetUserSnippet>
8585
async Task GreetUserAsync()
8686
{
8787
try
@@ -98,9 +98,9 @@ async Task GreetUserAsync()
9898
Console.WriteLine($"Error getting user: {ex.Message}");
9999
}
100100
}
101-
/* </GreetUserSnippet> */
101+
// </GreetUserSnippet>
102102

103-
/* <DisplayAccessTokenSnippet> */
103+
// <DisplayAccessTokenSnippet>
104104
async Task DisplayAccessTokenAsync()
105105
{
106106
try
@@ -113,9 +113,9 @@ async Task DisplayAccessTokenAsync()
113113
Console.WriteLine($"Error getting user access token: {ex.Message}");
114114
}
115115
}
116-
/* </DisplayAccessTokenSnippet> */
116+
// </DisplayAccessTokenSnippet>
117117

118-
/* <ListInboxSnippet> */
118+
// <ListInboxSnippet>
119119
async Task ListInboxAsync()
120120
{
121121
try
@@ -151,9 +151,9 @@ async Task ListInboxAsync()
151151
Console.WriteLine($"Error getting user's inbox: {ex.Message}");
152152
}
153153
}
154-
/* </ListInboxSnippet> */
154+
// </ListInboxSnippet>
155155

156-
/* <SendMailSnippet> */
156+
// <SendMailSnippet>
157157
async Task SendMailAsync()
158158
{
159159
try
@@ -182,11 +182,11 @@ await GraphHelper.SendMailAsync(
182182
Console.WriteLine($"Error sending mail: {ex.Message}");
183183
}
184184
}
185-
/* </SendMailSnippet> */
185+
// </SendMailSnippet>
186186

187-
/* <MakeGraphCallSnippet> */
187+
// <MakeGraphCallSnippet>
188188
async Task MakeGraphCallAsync()
189189
{
190190
await GraphHelper.MakeGraphCallAsync();
191191
}
192-
/* </MakeGraphCallSnippet> */
192+
// </MakeGraphCallSnippet>

0 commit comments

Comments
 (0)