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">
|
<Target Name="SetTemplateJsonSymbolReplacements">
|
||||||
<PropertyGroup>
|
<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
|
Properties here will be injected into the template config *.json files
|
||||||
during the build, replacing tokens of the form ${PropertyName}
|
during the build, replacing tokens of the form ${PropertyName}
|
||||||
-->
|
-->
|
||||||
<GeneratedContentProperties>
|
<GeneratedContentProperties>
|
||||||
IncludeCustomRestoreSources=$(IncludeCustomRestoreSourcesValue);
|
|
||||||
TemplateBlazorVersion=$(PackageVersion);
|
TemplateBlazorVersion=$(PackageVersion);
|
||||||
TemplateComponentsVersion=$(ComponentsPackageVersion);
|
TemplateComponentsVersion=$(ComponentsPackageVersion);
|
||||||
RepositoryCommit=$(SourceRevisionId);
|
RepositoryCommit=$(SourceRevisionId);
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,6 @@
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"binding": "HostIdentifier"
|
"binding": "HostIdentifier"
|
||||||
},
|
},
|
||||||
"IncludeCustomRestoreSourcesSymbol": {
|
|
||||||
"type": "parameter",
|
|
||||||
"datatype": "bool",
|
|
||||||
"description": "If set, includes restore sources for the Blazor MyGet feed.",
|
|
||||||
"defaultValue": "${IncludeCustomRestoreSources}"
|
|
||||||
},
|
|
||||||
"TemplateBlazorVersionSymbol": {
|
"TemplateBlazorVersionSymbol": {
|
||||||
"type": "parameter",
|
"type": "parameter",
|
||||||
"datatype": "string",
|
"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>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<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>
|
<LangVersion>7.3</LangVersion>
|
||||||
<RazorLangVersion>3.0</RazorLangVersion>
|
<RazorLangVersion>3.0</RazorLangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
<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>
|
<LangVersion>7.3</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace BlazorHosted_CSharp.Server
|
||||||
app.UseBlazorDebugging();
|
app.UseBlazorDebugging();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseBlazorClientSideFiles<Client.Startup>();
|
app.UseClientSideBlazorFiles<Client.Startup>();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,6 @@
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"binding": "HostIdentifier"
|
"binding": "HostIdentifier"
|
||||||
},
|
},
|
||||||
"IncludeCustomRestoreSourcesSymbol": {
|
|
||||||
"type": "parameter",
|
|
||||||
"datatype": "bool",
|
|
||||||
"description": "If set, includes restore sources for the Blazor MyGet feed.",
|
|
||||||
"defaultValue": "${IncludeCustomRestoreSources}"
|
|
||||||
},
|
|
||||||
"TemplateBlazorVersionSymbol": {
|
"TemplateBlazorVersionSymbol": {
|
||||||
"type": "parameter",
|
"type": "parameter",
|
||||||
"datatype": "string",
|
"datatype": "string",
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,6 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<IsPackable>true</IsPackable>
|
<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>
|
<LangVersion>7.3</LangVersion>
|
||||||
<RazorLangVersion>3.0</RazorLangVersion>
|
<RazorLangVersion>3.0</RazorLangVersion>
|
||||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,6 @@
|
||||||
"type": "bind",
|
"type": "bind",
|
||||||
"binding": "HostIdentifier"
|
"binding": "HostIdentifier"
|
||||||
},
|
},
|
||||||
"IncludeCustomRestoreSourcesSymbol": {
|
|
||||||
"type": "parameter",
|
|
||||||
"datatype": "bool",
|
|
||||||
"description": "If set, includes restore sources for the Blazor MyGet feed.",
|
|
||||||
"defaultValue": "${IncludeCustomRestoreSources}"
|
|
||||||
},
|
|
||||||
"TemplateBlazorVersionSymbol": {
|
"TemplateBlazorVersionSymbol": {
|
||||||
"type": "parameter",
|
"type": "parameter",
|
||||||
"datatype": "string",
|
"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>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<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>
|
<LangVersion>7.3</LangVersion>
|
||||||
<RazorLangVersion>3.0</RazorLangVersion>
|
<RazorLangVersion>3.0</RazorLangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,4 @@
|
||||||
<Project>
|
<Project>
|
||||||
<Import Project="$(MSBuildThisFileDirectory)..\..\..\..\build\dependencies.props" />
|
<Import Project="$(MSBuildThisFileDirectory)..\..\..\..\build\dependencies.props" />
|
||||||
<Import Project="$(MSBuildThisFileDirectory)..\..\..\..\build\sources.props" />
|
<Import Project="$(MSBuildThisFileDirectory)..\..\..\..\build\sources.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<IncludeCustomRestoreSourcesSymbol>true</IncludeCustomRestoreSourcesSymbol>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">RazorComponentsWeb_CSharp</RootNamespace>
|
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">RazorComponentsWeb_CSharp</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<!--#if (IndividualLocalAuth && UseLocalDB) -->
|
<!--#if (IndividualLocalAuth && !UseLocalDB) -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" />
|
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,65 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"condition": "(NoAuth)",
|
"condition": "(NoAuth)",
|
||||||
|
"rename": {
|
||||||
|
"Shared/MainLayout.NoAuth.razor": "Shared/MainLayout.razor"
|
||||||
|
},
|
||||||
"exclude": [
|
"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>
|
<CascadingAuthenticationState>
|
||||||
<Router AppAssembly="typeof(Startup).Assembly">
|
<Router AppAssembly="typeof(Startup).Assembly">
|
||||||
<NotFoundContent>
|
<NotFoundContent>
|
||||||
<h3>Page not found</h3>
|
|
||||||
<p>Sorry, there's nothing at this address.</p>
|
<p>Sorry, there's nothing at this address.</p>
|
||||||
</NotFoundContent>
|
</NotFoundContent>
|
||||||
</Router>
|
</Router>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
{
|
{
|
||||||
"iisSettings": {
|
"iisSettings": {
|
||||||
|
//#if (WindowsAuth)
|
||||||
|
"windowsAuthentication": true,
|
||||||
|
"anonymousAuthentication": false,
|
||||||
|
//#else
|
||||||
"windowsAuthentication": false,
|
"windowsAuthentication": false,
|
||||||
"anonymousAuthentication": true,
|
"anonymousAuthentication": true,
|
||||||
|
//#endif
|
||||||
"iisExpress": {
|
"iisExpress": {
|
||||||
"applicationUrl": "http://localhost:8080",
|
"applicationUrl": "http://localhost:8080",
|
||||||
//#if(RequiresHttps)
|
//#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.AspNetCore.Authentication.AzureADB2C.UI
|
||||||
@using Microsoft.Extensions.Options
|
@using Microsoft.Extensions.Options
|
||||||
@inject IOptionsMonitor<AzureADB2COptions> AzureADB2COptions
|
@inject IOptionsMonitor<AzureADB2COptions> AzureADB2COptions
|
||||||
|
|
@ -40,18 +28,3 @@
|
||||||
canEditProfile = !string.IsNullOrEmpty(options.EditProfilePolicyId);
|
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="main">
|
||||||
<div class="top-row px-4">
|
<div class="top-row px-4">
|
||||||
@*#if (!NoAuth)
|
|
||||||
<LogInDisplay />
|
<LogInDisplay />
|
||||||
#endif*@
|
|
||||||
<a href="https://docs.microsoft.com/en-us/aspnet/" target="_blank">About</a>
|
<a href="https://docs.microsoft.com/en-us/aspnet/" target="_blank">About</a>
|
||||||
</div>
|
</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