Skip to content

Commit cda89e5

Browse files
committed
Update ProjectTemplates to Id Web 2.12.2, which supports new MS Graph SDK v5. Updates are in project references (from 2.10 to 2.12.2), and new package reference from Microsoft.Identity.Web.MicrosoftGraph to Microsoft.Identity.Web.GraphServiceClient and updates in the respective controllers in graphserviceclient section.
1 parent f8c1bb3 commit cda89e5

File tree

12 files changed

+18
-18
lines changed

12 files changed

+18
-18
lines changed

eng/Versions.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@
294294
<DuendeIdentityServerStorageVersion>6.0.4</DuendeIdentityServerStorageVersion>
295295
<DuendeIdentityServerEntityFrameworkStorageVersion>6.0.4</DuendeIdentityServerEntityFrameworkStorageVersion>
296296
<MessagePackVersion>2.5.108</MessagePackVersion>
297-
<MicrosoftIdentityWebVersion>2.10.0</MicrosoftIdentityWebVersion>
298-
<MicrosoftIdentityWebMicrosoftGraphVersion>2.10.0</MicrosoftIdentityWebMicrosoftGraphVersion>
299-
<MicrosoftIdentityWebUIVersion>2.10.0</MicrosoftIdentityWebUIVersion>
300-
<MicrosoftIdentityWebDownstreamApiVersion>2.10.0</MicrosoftIdentityWebDownstreamApiVersion>
297+
<MicrosoftIdentityWebVersion>2.12.2</MicrosoftIdentityWebVersion>
298+
<MicrosoftIdentityWebGraphServiceClientVersion>2.12.2</MicrosoftIdentityWebGraphServiceClientVersion>
299+
<MicrosoftIdentityWebUIVersion>2.12.2</MicrosoftIdentityWebUIVersion>
300+
<MicrosoftIdentityWebDownstreamApiVersion>2.12.2</MicrosoftIdentityWebDownstreamApiVersion>
301301
<MessagePackAnalyzerVersion>$(MessagePackVersion)</MessagePackAnalyzerVersion>
302302
<MoqVersion>4.10.0</MoqVersion>
303303
<MonoCecilVersion>0.11.2</MonoCecilVersion>

src/ProjectTemplates/Web.ProjectTemplates/BlazorServerWeb-CSharp.csproj.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="${MicrosoftAspNetCoreAuthenticationNegotiateVersion}" Condition="'$(WindowsAuth)' == 'True'" />
3030
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="${MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" NoWarn="NU1605" />
3131
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
32-
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
32+
<PackageReference Include="Microsoft.Identity.Web.GraphServiceClient" Version="${MicrosoftIdentityWebGraphServiceClientVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
3333
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
3434
<PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="${MicrosoftIdentityWebDownstreamApiVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
3535
</ItemGroup>

src/ProjectTemplates/Web.ProjectTemplates/ComponentsWebAssembly-CSharp.Server.csproj.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="${MicrosoftAspNetCoreAuthenticationJwtBearerVersion}" NoWarn="NU1605" />
4444
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="${MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion}" NoWarn="NU1605" />
4545
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebVersion}" />
46-
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
46+
<PackageReference Include="Microsoft.Identity.Web.GraphServiceClient" Version="${MicrosoftIdentityWebGraphServiceClientVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
4747
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIVersion}" />
4848
<PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="${MicrosoftIdentityWebDownstreamApiVersion}" />
4949
</ItemGroup>

src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
MicrosoftExtensionsHostingVersion=$(MicrosoftExtensionsHostingVersion);
2121
MicrosoftExtensionsHttpVersion=$(MicrosoftExtensionsHttpVersion);
2222
MicrosoftIdentityWebVersion=$(MicrosoftIdentityWebVersion);
23-
MicrosoftIdentityWebMicrosoftGraphVersion=$(MicrosoftIdentityWebMicrosoftGraphVersion);
23+
MicrosoftIdentityWebGraphServiceClientVersion=$(MicrosoftIdentityWebGraphServiceClientVersion);
2424
MicrosoftIdentityWebUIVersion=$(MicrosoftIdentityWebUIVersion);
2525
MicrosoftIdentityWebDownstreamApiVersion=$(MicrosoftIdentityWebDownstreamApiVersion);
2626
MicrosoftNETCoreAppRuntimeVersion=$(MicrosoftNETCoreAppRuntimeVersion);

src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="${MicrosoftAspNetCoreAuthenticationNegotiateVersion}" Condition="'$(WindowsAuth)' == 'True'" />
2828
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="${MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" NoWarn="NU1605" />
2929
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
30-
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
30+
<PackageReference Include="Microsoft.Identity.Web.GraphServiceClient" Version="${MicrosoftIdentityWebGraphServiceClientVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
3131
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
3232
<PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="${MicrosoftIdentityWebDownstreamApiVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
3333
</ItemGroup>

src/ProjectTemplates/Web.ProjectTemplates/StarterWeb-CSharp.csproj.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="${MicrosoftAspNetCoreAuthenticationNegotiateVersion}" Condition="'$(WindowsAuth)' == 'True'" />
2828
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="${MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" NoWarn="NU1605" />
2929
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
30-
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
30+
<PackageReference Include="Microsoft.Identity.Web.GraphServiceClient" Version="${MicrosoftIdentityWebGraphServiceClientVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
3131
<PackageReference Include="Microsoft.Identity.Web.UI" Version="${MicrosoftIdentityWebUIVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
3232
<PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="${MicrosoftIdentityWebDownstreamApiVersion}" Condition=" '$(IndividualB2CAuth)' == 'True' OR '$(OrganizationalAuth)' == 'True'" />
3333
</ItemGroup>

src/ProjectTemplates/Web.ProjectTemplates/WebApi-CSharp.csproj.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="${MicrosoftAspNetCoreAuthenticationOpenIdConnectVersion}" Condition="'$(OrganizationalAuth)' == 'True' OR '$(IndividualB2CAuth)' == 'True'" />
1818
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="${MicrosoftAspNetCoreOpenApiVersion}" Condition="'$(EnableOpenAPI)' == 'True'" />
1919
<PackageReference Include="Microsoft.Identity.Web" Version="${MicrosoftIdentityWebVersion}" Condition="'$(OrganizationalAuth)' == 'True' OR '$(IndividualB2CAuth)' == 'True'"/>
20-
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="${MicrosoftIdentityWebMicrosoftGraphVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
20+
<PackageReference Include="Microsoft.Identity.Web.GraphServiceClient" Version="${MicrosoftIdentityWebGraphServiceClientVersion}" Condition=" '$(GenerateGraph)' == 'True' " />
2121
<PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="${MicrosoftIdentityWebDownstreamApiVersion}" Condition="'$(OrganizationalAuth)' == 'True' OR '$(IndividualB2CAuth)' == 'True'"/>
2222
<PackageReference Include="Swashbuckle.AspNetCore" Version="${SwashbuckleAspNetCoreVersion}" Condition="'$(EnableOpenAPI)' == 'True'" />
2323
</ItemGroup>

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/ShowProfile.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ else
2222
</tr>
2323
<tr>
2424
<td>Name</td>
25-
<td>@user.DisplayName</td>
25+
<td>@user?.DisplayName</td>
2626
</tr>
2727
</table>
2828
}
@@ -34,7 +34,7 @@ else
3434
{
3535
try
3636
{
37-
user = await GraphServiceClient.Me.Request().GetAsync();
37+
user = await GraphServiceClient.Me.GetAsync();
3838
}
3939
catch (Exception ex)
4040
{

src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Controllers/WeatherForecastController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public WeatherForecastController(ILogger<WeatherForecastController> logger,
8383
[HttpGet]
8484
public async Task<IEnumerable<WeatherForecast>> Get()
8585
{
86-
var user = await _graphServiceClient.Me.Request().GetAsync();
86+
var user = await _graphServiceClient.Me.GetAsync();
8787

8888
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
8989
{

src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public IndexModel(ILogger<IndexModel> logger,
5656

5757
public async Task OnGet()
5858
{
59-
var user = await _graphServiceClient.Me.Request().GetAsync();
59+
var user = await _graphServiceClient.Me.GetAsync();
6060

61-
ViewData["ApiResult"] = user.DisplayName;
61+
ViewData["ApiResult"] = user?.DisplayName;
6262
}
6363
#else
6464
public IndexModel(ILogger<IndexModel> logger)

src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public HomeController(ILogger<HomeController> logger,
6363
[AuthorizeForScopes(ScopeKeySection = "DownstreamApi:Scopes")]
6464
public async Task<IActionResult> Index()
6565
{
66-
var user = await _graphServiceClient.Me.Request().GetAsync();
67-
ViewData["ApiResult"] = user.DisplayName;
66+
var user = await _graphServiceClient.Me.GetAsync();
67+
ViewData["ApiResult"] = user?.DisplayName;
6868

6969
return View();
7070
}

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public WeatherForecastController(ILogger<WeatherForecastController> logger,
9090
#endif
9191
public async Task<IEnumerable<WeatherForecast>> Get()
9292
{
93-
var user = await _graphServiceClient.Me.Request().GetAsync();
93+
var user = await _graphServiceClient.Me.GetAsync();
9494

9595
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
9696
{

0 commit comments

Comments
 (0)