-
Notifications
You must be signed in to change notification settings - Fork 73
Upgrade WebDemo sample to .NET 8 #1059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhenlan
wants to merge
3
commits into
main
Choose a base branch
from
webdemo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
50 changes: 25 additions & 25 deletions
50
...es/DotNetCore/WebDemoNet6/WebDemoNet6.sln → examples/DotNetCore/WebDemo/WebDemo.sln
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.1.32015.303 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDemoNet6", "WebDemoNet6\WebDemoNet6.csproj", "{6003C39B-DE37-4799-B8C6-B5BDB58A6461}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6003C39B-DE37-4799-B8C6-B5BDB58A6461}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6003C39B-DE37-4799-B8C6-B5BDB58A6461}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6003C39B-DE37-4799-B8C6-B5BDB58A6461}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6003C39B-DE37-4799-B8C6-B5BDB58A6461}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {04296B4E-C016-487C-818B-AC3CCF5993E7} | ||
EndGlobalSection | ||
EndGlobal | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.14.36119.2 d17.14 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDemo", "WebDemo\WebDemo.csproj", "{7D342A3D-3386-F48E-2FD0-340DF151EAD4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{7D342A3D-3386-F48E-2FD0-340DF151EAD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7D342A3D-3386-F48E-2FD0-340DF151EAD4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7D342A3D-3386-F48E-2FD0-340DF151EAD4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7D342A3D-3386-F48E-2FD0-340DF151EAD4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {6D318ED3-1FC2-4ADD-AE37-C4BF4D7D7CAC} | ||
EndGlobalSection | ||
EndGlobal |
File renamed without changes.
5 changes: 4 additions & 1 deletion
5
...DemoNet6/WebDemoNet6/Pages/Beta.cshtml.cs → ...Core/WebDemo/WebDemo/Pages/Beta.cshtml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
5 changes: 4 additions & 1 deletion
5
...emoNet6/WebDemoNet6/Pages/Error.cshtml.cs → ...ore/WebDemo/WebDemo/Pages/Error.cshtml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 5 additions & 2 deletions
7
...emoNet6/WebDemoNet6/Pages/Index.cshtml.cs → ...ore/WebDemo/WebDemo/Pages/Index.cshtml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 4 additions & 2 deletions
6
...oNet6/WebDemoNet6/Pages/Privacy.cshtml.cs → ...e/WebDemo/WebDemo/Pages/Privacy.cshtml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...et6/WebDemoNet6/Pages/_ViewImports.cshtml → ...WebDemo/WebDemo/Pages/_ViewImports.cshtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@using WebDemoNet6 | ||
@namespace WebDemoNet6.Pages | ||
@using WebDemo | ||
@namespace WebDemo.Pages | ||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers | ||
@addTagHelper *, Microsoft.FeatureManagement.AspNetCore |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// | ||
using Azure.Identity; | ||
using Microsoft.FeatureManagement; | ||
using WebDemo; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Get the Azure App Configuration endpoint from environment or settings | ||
string? appConfigEndpoint = builder.Configuration["AppConfig:Endpoint"] ?? | ||
Environment.GetEnvironmentVariable("AppConfigEndpoint"); | ||
|
||
// Load configuration from Azure App Configuration | ||
if (!string.IsNullOrEmpty(appConfigEndpoint)) | ||
{ | ||
builder.Configuration.AddAzureAppConfiguration(options => | ||
{ | ||
// Use DefaultAzureCredential for Microsoft Entra ID authentication | ||
options.Connect(new Uri(appConfigEndpoint), new DefaultAzureCredential()) | ||
// Load all keys that start with `WebDemo:` and have no label | ||
.Select("WebDemo:*") | ||
// Reload configuration if any selected key-values have changed | ||
zhenlan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.ConfigureRefresh(refreshOptions => | ||
{ | ||
refreshOptions.RegisterAll(); | ||
}) | ||
// Load all feature flags with no label | ||
.UseFeatureFlags(); | ||
}); | ||
} | ||
|
||
// Add services to the container | ||
builder.Services.AddRazorPages(); | ||
builder.Services.AddHttpContextAccessor(); | ||
|
||
// Add Azure App Configuration and feature management services to the container | ||
builder.Services.AddAzureAppConfiguration(); | ||
builder.Services.AddFeatureManagement(); | ||
|
||
// Bind configuration to the Settings object | ||
builder.Services.Configure<Settings>(builder.Configuration.GetSection("WebDemo:Settings")); | ||
|
||
var app = builder.Build(); | ||
|
||
// Configure the HTTP request pipeline | ||
if (!app.Environment.IsDevelopment()) | ||
{ | ||
app.UseExceptionHandler("/Error"); | ||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts | ||
app.UseHsts(); | ||
} | ||
|
||
// Use Azure App Configuration middleware for dynamic configuration refresh | ||
app.UseAzureAppConfiguration(); | ||
|
||
app.UseHttpsRedirection(); | ||
app.UseStaticFiles(); | ||
|
||
app.UseRouting(); | ||
app.UseAuthorization(); | ||
|
||
app.MapRazorPages(); | ||
|
||
app.Run(); |
5 changes: 4 additions & 1 deletion
5
...tCore/WebDemoNet6/WebDemoNet6/Settings.cs → ...es/DotNetCore/WebDemo/WebDemo/Settings.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
...ebDemoNet6/WebDemoNet6/WebDemoNet6.csproj → ...DotNetCore/WebDemo/WebDemo/WebDemo.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="5.0.0" /> | ||
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="2.5.0" /> | ||
<PackageReference Include="Azure.Identity" Version="1.14.0" /> | ||
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="8.2.0" /> | ||
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="4.0.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using the ASP.NET Core environment variable naming convention (
AppConfig__Endpoint
) so the configuration binder can automatically map nested settings.Copilot uses AI. Check for mistakes.