Blazor template fixes (#10770)
* Invert UseLocalDB condition in template * Replace UseBlazorClientSideFiles with UseClientSideBlazorFiles * Add NotFoundContent to client-side templates, and make all consistent * In client-side templates, remove references to MyGet feeds as they are no longer updated * Workaround for lack of conditionals in .razor: Two separate versions of MainLayout.razor * Workaround for lack of conditionals in .razor: Four variants of LoginDisplay.*.razor * Fix launchSettings for Windows auth
This commit is contained in:
parent
851a1eeb39
commit
55b310d16b
|
|
@ -11,15 +11,11 @@
|
|||
|
||||
<Target Name="SetTemplateJsonSymbolReplacements">
|
||||
<PropertyGroup>
|
||||
<IncludeCustomRestoreSourcesValue>true</IncludeCustomRestoreSourcesValue>
|
||||
<IncludeCustomRestoreSourcesValue Condition=" '$(IsFinalBuild)' == 'true' AND ('$(PreReleaseLabel)' == 'servicing' OR '$(PreReleaseLabel)' == 'rtm')">false</IncludeCustomRestoreSourcesValue>
|
||||
|
||||
<!--
|
||||
Properties here will be injected into the template config *.json files
|
||||
during the build, replacing tokens of the form ${PropertyName}
|
||||
-->
|
||||
<GeneratedContentProperties>
|
||||
IncludeCustomRestoreSources=$(IncludeCustomRestoreSourcesValue);
|
||||
TemplateBlazorVersion=$(PackageVersion);
|
||||
TemplateComponentsVersion=$(ComponentsPackageVersion);
|
||||
RepositoryCommit=$(SourceRevisionId);
|
||||
|
|
|
|||
|
|
@ -71,12 +71,6 @@
|
|||
"type": "bind",
|
||||
"binding": "HostIdentifier"
|
||||
},
|
||||
"IncludeCustomRestoreSourcesSymbol": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If set, includes restore sources for the Blazor MyGet feed.",
|
||||
"defaultValue": "${IncludeCustomRestoreSources}"
|
||||
},
|
||||
"TemplateBlazorVersionSymbol": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
<Router AppAssembly="typeof(Program).Assembly" />
|
||||
<Router AppAssembly="typeof(Program).Assembly">
|
||||
<NotFoundContent>
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</NotFoundContent>
|
||||
</Router>
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RestoreAdditionalProjectSources Condition="'$(IncludeCustomRestoreSourcesSymbol)'=='true'">
|
||||
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
|
||||
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
|
||||
</RestoreAdditionalProjectSources>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<RazorLangVersion>3.0</RazorLangVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RestoreAdditionalProjectSources Condition="'$(IncludeCustomRestoreSourcesSymbol)'=='true'">
|
||||
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
|
||||
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
|
||||
</RestoreAdditionalProjectSources>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace BlazorHosted_CSharp.Server
|
|||
app.UseBlazorDebugging();
|
||||
}
|
||||
|
||||
app.UseBlazorClientSideFiles<Client.Startup>();
|
||||
app.UseClientSideBlazorFiles<Client.Startup>();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
|
|
|
|||
|
|
@ -43,12 +43,6 @@
|
|||
"type": "bind",
|
||||
"binding": "HostIdentifier"
|
||||
},
|
||||
"IncludeCustomRestoreSourcesSymbol": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If set, includes restore sources for the Blazor MyGet feed.",
|
||||
"defaultValue": "${IncludeCustomRestoreSources}"
|
||||
},
|
||||
"TemplateBlazorVersionSymbol": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<IsPackable>true</IsPackable>
|
||||
<RestoreAdditionalProjectSources Condition="'$(IncludeCustomRestoreSourcesSymbol)'=='true'">
|
||||
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
|
||||
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
|
||||
</RestoreAdditionalProjectSources>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<RazorLangVersion>3.0</RazorLangVersion>
|
||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||
|
|
|
|||
|
|
@ -44,12 +44,6 @@
|
|||
"type": "bind",
|
||||
"binding": "HostIdentifier"
|
||||
},
|
||||
"IncludeCustomRestoreSourcesSymbol": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If set, includes restore sources for the Blazor MyGet feed.",
|
||||
"defaultValue": "${IncludeCustomRestoreSources}"
|
||||
},
|
||||
"TemplateBlazorVersionSymbol": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
<Router AppAssembly="typeof(Program).Assembly" />
|
||||
<Router AppAssembly="typeof(Program).Assembly">
|
||||
<NotFoundContent>
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</NotFoundContent>
|
||||
</Router>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<RestoreAdditionalProjectSources Condition="'$(IncludeCustomRestoreSourcesSymbol)'=='true'">
|
||||
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
|
||||
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
|
||||
</RestoreAdditionalProjectSources>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<RazorLangVersion>3.0</RazorLangVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,4 @@
|
|||
<Project>
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\..\..\build\dependencies.props" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\..\..\build\sources.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<IncludeCustomRestoreSourcesSymbol>true</IncludeCustomRestoreSourcesSymbol>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">RazorComponentsWeb_CSharp</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--#if (IndividualLocalAuth && UseLocalDB) -->
|
||||
<!--#if (IndividualLocalAuth && !UseLocalDB) -->
|
||||
<ItemGroup>
|
||||
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -67,8 +67,65 @@
|
|||
},
|
||||
{
|
||||
"condition": "(NoAuth)",
|
||||
"rename": {
|
||||
"Shared/MainLayout.NoAuth.razor": "Shared/MainLayout.razor"
|
||||
},
|
||||
"exclude": [
|
||||
"Shared/LoginDisplay.razor"
|
||||
"Shared/LoginDisplay.*.razor",
|
||||
"Shared/MainLayout.Auth.razor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(!NoAuth)",
|
||||
"rename": {
|
||||
"Shared/MainLayout.Auth.razor": "Shared/MainLayout.razor"
|
||||
},
|
||||
"exclude": [
|
||||
"Shared/MainLayout.NoAuth.razor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(IndividualLocalAuth)",
|
||||
"rename": {
|
||||
"Shared/LoginDisplay.IndividualLocalAuth.razor": "Shared/LoginDisplay.razor"
|
||||
},
|
||||
"exclude": [
|
||||
"Shared/LoginDisplay.IndividualB2CAuth.razor",
|
||||
"Shared/LoginDisplay.OrganizationalAuth.razor",
|
||||
"Shared/LoginDisplay.WindowsAuth.razor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(IndividualB2CAuth)",
|
||||
"rename": {
|
||||
"Shared/LoginDisplay.IndividualB2CAuth.razor": "Shared/LoginDisplay.razor"
|
||||
},
|
||||
"exclude": [
|
||||
"Shared/LoginDisplay.IndividualLocalAuth.razor",
|
||||
"Shared/LoginDisplay.OrganizationalAuth.razor",
|
||||
"Shared/LoginDisplay.WindowsAuth.razor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(OrganizationalAuth)",
|
||||
"rename": {
|
||||
"Shared/LoginDisplay.OrganizationalAuth.razor": "Shared/LoginDisplay.razor"
|
||||
},
|
||||
"exclude": [
|
||||
"Shared/LoginDisplay.IndividualLocalAuth.razor",
|
||||
"Shared/LoginDisplay.IndividualB2CAuth.razor",
|
||||
"Shared/LoginDisplay.WindowsAuth.razor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "(WindowsAuth)",
|
||||
"rename": {
|
||||
"Shared/LoginDisplay.WindowsAuth.razor": "Shared/LoginDisplay.razor"
|
||||
},
|
||||
"exclude": [
|
||||
"Shared/LoginDisplay.IndividualLocalAuth.razor",
|
||||
"Shared/LoginDisplay.IndividualB2CAuth.razor",
|
||||
"Shared/LoginDisplay.OrganizationalAuth.razor"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<CascadingAuthenticationState>
|
||||
<Router AppAssembly="typeof(Startup).Assembly">
|
||||
<NotFoundContent>
|
||||
<h3>Page not found</h3>
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</NotFoundContent>
|
||||
</Router>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
//#if (WindowsAuth)
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": false,
|
||||
//#else
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
//#endif
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:8080",
|
||||
//#if(RequiresHttps)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,3 @@
|
|||
@*#if (IndividualLocalAuth)
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<a href="Identity/Account/Manage">Hello, @context.User.Identity.Name!</a>
|
||||
<a href="Identity/Account/LogOut">Log out</a>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<a href="Identity/Account/Register">Register</a>
|
||||
<a href="Identity/Account/Login">Log in</a>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
#elseif (IndividualB2CAuth)
|
||||
@using Microsoft.AspNetCore.Authentication.AzureADB2C.UI
|
||||
@using Microsoft.Extensions.Options
|
||||
@inject IOptionsMonitor<AzureADB2COptions> AzureADB2COptions
|
||||
|
|
@ -40,18 +28,3 @@
|
|||
canEditProfile = !string.IsNullOrEmpty(options.EditProfilePolicyId);
|
||||
}
|
||||
}
|
||||
#elseif (OrganizationalAuth)
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
Hello, @context.User.Identity.Name!
|
||||
<a href="AzureAD/Account/SignOut">Log out</a>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<a href="AzureAD/Account/SignIn">Log in</a>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
#elseif (WindowsAuth)
|
||||
<AuthorizeView>
|
||||
Hello, @context.User.Identity.Name!
|
||||
</AuthorizeView>
|
||||
#endif*@
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<a href="Identity/Account/Manage">Hello, @context.User.Identity.Name!</a>
|
||||
<a href="Identity/Account/LogOut">Log out</a>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<a href="Identity/Account/Register">Register</a>
|
||||
<a href="Identity/Account/Login">Log in</a>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<AuthorizeView>
|
||||
<Authorized>
|
||||
Hello, @context.User.Identity.Name!
|
||||
<a href="AzureAD/Account/SignOut">Log out</a>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<a href="AzureAD/Account/SignIn">Log in</a>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<AuthorizeView>
|
||||
Hello, @context.User.Identity.Name!
|
||||
</AuthorizeView>
|
||||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
<div class="main">
|
||||
<div class="top-row px-4">
|
||||
@*#if (!NoAuth)
|
||||
<LogInDisplay />
|
||||
#endif*@
|
||||
<a href="https://docs.microsoft.com/en-us/aspnet/" target="_blank">About</a>
|
||||
</div>
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
@inherits LayoutComponentBase
|
||||
|
||||
<div class="sidebar">
|
||||
<NavMenu />
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="top-row px-4">
|
||||
<a href="https://docs.microsoft.com/en-us/aspnet/" target="_blank">About</a>
|
||||
</div>
|
||||
|
||||
<div class="content px-4">
|
||||
@Body
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue