diff --git a/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Client.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Client.csproj.in new file mode 100644 index 000000000000..4b413350265b --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Client.csproj.in @@ -0,0 +1,33 @@ + + + + ${DefaultNetCoreTargetFramework} + enable + enable + + service-worker-assets.js + + + `$(AssemblyName.Replace(' ', '_')) + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Server.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Server.csproj.in new file mode 100644 index 000000000000..f54a03b7f488 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Server.csproj.in @@ -0,0 +1,21 @@ + + + + ${DefaultNetCoreTargetFramework} + enable + enable + True + EmptyComponentsWebAssembly-CSharp.Server + `$(AssemblyName.Replace(' ', '_')) + + + + + + + + + + + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Shared.csproj.in b/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Shared.csproj.in new file mode 100644 index 000000000000..ba1c0026e997 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/EmptyComponentsWebAssembly-CSharp.Shared.csproj.in @@ -0,0 +1,12 @@ + + + + ${DefaultNetCoreTargetFramework} + enable + enable + + + + + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj index 2dc413643421..80e8cb93d759 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj +++ b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj @@ -67,6 +67,9 @@ + + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/dotnetcli.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/dotnetcli.host.json new file mode 100644 index 000000000000..f650ca83fa3b --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/dotnetcli.host.json @@ -0,0 +1,42 @@ +{ + "$schema": "http://json.schemastore.org/dotnetcli.host", + "symbolInfo": { + "skipRestore": { + "longName": "no-restore", + "shortName": "" + }, + "Hosted": { + "longName": "hosted" + }, + "PWA": { + "longName": "pwa" + }, + "Framework": { + "longName": "framework" + }, + "kestrelHttpPort": { + "isHidden": true + }, + "kestrelHttpsPort": { + "isHidden": true + }, + "iisHttpPort": { + "isHidden": true + }, + "iisHttpsPort": { + "isHidden": true + }, + "ExcludeLaunchSettings": { + "longName": "exclude-launch-settings", + "shortName": "" + }, + "NoHttps": { + "longName": "no-https", + "shortName": "" + }, + "CalledApiUrl": { + "longName": "called-api-url", + "shortName": "" + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/ide.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/ide.host.json new file mode 100644 index 000000000000..8e687ab7bce9 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/ide.host.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json.schemastore.org/ide.host", + "order": 660, + "icon": "ide/icon.png", + "disableHttpsSymbol": "NoHttps", + "symbolInfo": [ + { + "id": "Hosted", + "isVisible": "true", + "persistenceScope": "templateGroup" + }, + { + "id": "PWA", + "isVisible": "true", + "persistenceScope": "templateGroup" + } + ], + "tags": [ + { + "type": "projectType", + "add": [ "Cloud", "Web" ], + "remove": [ "*" ] + }, + { + "type": "platform", + "add": [ "Linux", "macOS", "Windows" ] + } + ] +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/ide/icon.png b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/ide/icon.png new file mode 100644 index 000000000000..8422b5969593 Binary files /dev/null and b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/ide/icon.png differ diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.cs.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.cs.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.cs.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.de.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.de.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.de.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.en.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.en.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.en.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.es.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.es.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.es.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.fr.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.fr.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.fr.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.it.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.it.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.it.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ja.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ja.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ja.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ko.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ko.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ko.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.pl.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.pl.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.pl.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.pt-BR.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.pt-BR.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.pt-BR.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ru.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ru.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.ru.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.tr.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.tr.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.tr.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.zh-Hans.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.zh-Hans.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.zh-Hans.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.zh-Hant.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.zh-Hant.json new file mode 100644 index 000000000000..cd69b8df8493 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/localize/templatestrings.zh-Hant.json @@ -0,0 +1,23 @@ +{ + "author": "Microsoft", + "name": "Blazor WebAssembly App Empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "symbols/Framework/description": "The target framework for the project.", + "symbols/Framework/choices/net7.0/description": "Target net7.0", + "symbols/skipRestore/description": "If specified, skips the automatic restore of the project on create.", + "symbols/Hosted/displayName": "ASP.NET Core _Hosted", + "symbols/Hosted/description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app.", + "symbols/ExcludeLaunchSettings/description": "Whether to exclude launchSettings.json from the generated template.", + "symbols/kestrelHttpPort/description": "Port number to use for the HTTP endpoint in launchSettings.json.", + "symbols/kestrelHttpsPort/description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/iisHttpPort/description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json.", + "symbols/iisHttpsPort/description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used.", + "symbols/PWA/displayName": "_Progressive Web Application", + "symbols/PWA/description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use.", + "symbols/HasHttpProfile/description": "Always have HTTP profile.", + "symbols/NoHttps/description": "Whether to turn off HTTPS.", + "postActions/restore/description": "Restore NuGet packages required by this project.", + "postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'", + "postActions/restoreClient/description": "Restore NuGet packages required by this project.", + "postActions/restoreClient/manualInstructions/default/text": "Run 'dotnet restore'" +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/template.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/template.json new file mode 100644 index 000000000000..99a034666408 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/.template.config/template.json @@ -0,0 +1,275 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "Microsoft", + "classifications": [ + "Web", + "Blazor", + "WebAssembly", + "PWA", + "Empty" + ], + "name": "Blazor WebAssembly App Empty", + "defaultName": "BlazorApp-empty", + "description": "An empty project template for creating a Blazor app that runs on WebAssembly and is optionally hosted by an ASP.NET Core app. This template does not have any content in it.", + "groupIdentity": "Microsoft.Web.Blazor.Wasm.Empty", + "precedence": "9000", + "identity": "Microsoft.Web.Blazor.Wasm.Empty.CSharp.7.0", + "thirdPartyNotices": "https://aka.ms/aspnetcore/7.0-third-party-notices", + "preferNameDirectory": true, + "primaryOutputs": [ + { + "condition": "(Hosted && (HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\"))", + "path": "EmptyComponentsWebAssembly-CSharp.sln" + }, + { + "condition": "(Hosted && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")", + "path": "Server/EmptyComponentsWebAssembly-CSharp.Server.csproj" + }, + { + "condition": "(!Hosted)", + "path": "EmptyComponentsWebAssembly-CSharp.csproj" + }, + { + "condition": "(Hosted && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")", + "path": "Client/EmptyComponentsWebAssembly-CSharp.Client.csproj" + }, + { + "condition": "(Hosted && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")", + "path": "Shared/EmptyComponentsWebAssembly-CSharp.Shared.csproj" + } + ], + "shortName": "blazorwasm-empty", + "sourceName": "EmptyComponentsWebAssembly-CSharp", + "sources": [ + { + "source": "./", + "target": "./", + "exclude": [ + ".template.config/**" + ], + "copyOnly": [ + "**/wwwroot/css/**" + ], + "modifiers": [ + { + "condition": "(ExcludeLaunchSettings)", + "exclude": [ + "Properties/launchSettings.json" + ] + }, + { + "condition": "(!Hosted)", + "exclude": [ + "Server/**", + "Shared/**", + "*.sln" + ], + "rename": { + ".Client.csproj": ".csproj", + "Client": "." + } + }, + { + "condition": "(Hosted && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")", + "exclude": [ + "*.sln" + ] + }, + { + "condition": "(!PWA)", + "exclude": [ + "Client/wwwroot/service-worker*.js", + "Client/wwwroot/manifest.json", + "Client/wwwroot/icon-512.png" + ] + } + ] + } + ], + "symbols": { + "Framework": { + "type": "parameter", + "description": "The target framework for the project.", + "datatype": "choice", + "choices": [ + { + "choice": "net7.0", + "description": "Target net7.0" + } + ], + "replaces": "net7.0", + "defaultValue": "net7.0" + }, + "HostIdentifier": { + "type": "bind", + "binding": "HostIdentifier" + }, + "skipRestore": { + "type": "parameter", + "datatype": "bool", + "description": "If specified, skips the automatic restore of the project on create.", + "defaultValue": "false" + }, + "Hosted": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "false", + "displayName": "ASP.NET Core _Hosted", + "description": "If specified, includes an ASP.NET Core host for the Blazor WebAssembly app." + }, + "ExcludeLaunchSettings": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "false", + "description": "Whether to exclude launchSettings.json from the generated template." + }, + "kestrelHttpPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the HTTP endpoint in launchSettings.json." + }, + "kestrelHttpPortGenerated": { + "type": "generated", + "generator": "port", + "parameters": { + "low": 5000, + "high": 5300 + } + }, + "kestrelHttpPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "kestrelHttpPort", + "fallbackVariableName": "kestrelHttpPortGenerated" + }, + "replaces": "5000" + }, + "kestrelHttpsPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used." + }, + "kestrelHttpsPortGenerated": { + "type": "generated", + "generator": "port", + "parameters": { + "low": 7000, + "high": 7300 + } + }, + "kestrelHttpsPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "kestrelHttpsPort", + "fallbackVariableName": "kestrelHttpsPortGenerated" + }, + "replaces": "5001" + }, + "iisHttpPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json." + }, + "iisHttpPortGenerated": { + "type": "generated", + "generator": "port" + }, + "iisHttpPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "iisHttpPort", + "fallbackVariableName": "iisHttpPortGenerated" + }, + "replaces": "8080" + }, + "iisHttpsPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used." + }, + "iisHttpsPortGenerated": { + "type": "generated", + "generator": "port", + "parameters": { + "low": 44300, + "high": 44399 + } + }, + "iisHttpsPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "iisHttpsPort", + "fallbackVariableName": "iisHttpsPortGenerated" + }, + "replaces": "44300" + }, + "PWA": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "false", + "displayName": "_Progressive Web Application", + "description": "If specified, produces a Progressive Web Application (PWA) supporting installation and offline use." + }, + "HasHttpProfile": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "true", + "description": "Always have HTTP profile." + }, + "HasHttpsProfile": { + "type": "computed", + "value": "(!NoHttps)" + }, + "NoHttps": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "false", + "description": "Whether to turn off HTTPS." + }, + "copyrightYear": { + "type": "generated", + "generator": "now", + "replaces": "copyrightYear", + "parameters": { + "format": "yyyy" + } + } + }, + "tags": { + "language": "C#", + "type": "project" + }, + "postActions": [ + { + "id": "restore", + "condition": "(!skipRestore && Hosted)", + "description": "Restore NuGet packages required by this project.", + "manualInstructions": [ + { + "text": "Run 'dotnet restore'" + } + ], + "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", + "continueOnError": true + }, + { + "id": "restoreClient", + "condition": "(!skipRestore && !Hosted)", + "description": "Restore NuGet packages required by this project.", + "manualInstructions": [ + { + "text": "Run 'dotnet restore'" + } + ], + "args": { + "files": [ "EmptyComponentsWebAssembly-CSharp.Client.csproj" ] + }, + "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", + "continueOnError": true + } + ] +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/App.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/App.razor new file mode 100644 index 000000000000..6fd3ed1b5a3b --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/App.razor @@ -0,0 +1,12 @@ + + + + + + + Not found + +

Sorry, there's nothing at this address.

+
+
+
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/MainLayout.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/MainLayout.razor new file mode 100644 index 000000000000..a5af3489ae82 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/MainLayout.razor @@ -0,0 +1,3 @@ +@inherits LayoutComponentBase + +
@Body
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Pages/Index.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Pages/Index.razor new file mode 100644 index 000000000000..cba3252e00cd --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Pages/Index.razor @@ -0,0 +1,3 @@ +@page "/" + +

Hello, world!

diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Program.cs new file mode 100644 index 000000000000..e5be5e452d0f --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Program.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +#if (Hosted) +using EmptyComponentsWebAssembly_CSharp.Client; +#else +using EmptyComponentsWebAssembly_CSharp; +#endif + +var builder = WebAssemblyHostBuilder.CreateDefault(args); +builder.RootComponents.Add("#app"); +builder.RootComponents.Add("head::after"); + +#if (!Hosted) +builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); +#else +builder.Services.AddHttpClient("EmptyComponentsWebAssembly_CSharp.ServerAPI", client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)); + +// Supply HttpClient instances that include access tokens when making requests to the server project +builder.Services.AddScoped(sp => sp.GetRequiredService().CreateClient("EmptyComponentsWebAssembly_CSharp.ServerAPI")); +#endif + +await builder.Build().RunAsync(); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Properties/launchSettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Properties/launchSettings.json new file mode 100644 index 000000000000..ae527fca2e92 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/Properties/launchSettings.json @@ -0,0 +1,46 @@ +{ + "iisSettings": { + "iisExpress": { + "applicationUrl": "http://localhost:8080", + //#if(HasHttpsProfile) + "sslPort": 44300 + //#else + "sslPort": 0 + //#endif + } + }, + "profiles": { + //#if (HasHttpProfile) + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + //#endif + //#if (HasHttpsProfile) + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + //#endif + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/_Imports.razor b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/_Imports.razor new file mode 100644 index 000000000000..31cd28c45797 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/_Imports.razor @@ -0,0 +1,11 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.WebAssembly.Http +@using Microsoft.JSInterop +@*#if (!Hosted) +@using EmptyComponentsWebAssembly_CSharp +#else +@using EmptyComponentsWebAssembly_CSharp.Client +#endif*@ diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/css/app.css b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/css/app.css new file mode 100644 index 000000000000..3afadc202ee5 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/css/app.css @@ -0,0 +1,28 @@ +#blazor-error-ui { + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + + #blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 0.75rem; + top: 0.5rem; + } + +.blazor-error-boundary { + background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; + padding: 1rem 1rem 1rem 3.7rem; + color: white; +} + + .blazor-error-boundary::after { + content: "An error has occurred." + } diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/icon-512.png b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/icon-512.png new file mode 100644 index 000000000000..c2dd4842dc93 Binary files /dev/null and b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/icon-512.png differ diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/index.html b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/index.html new file mode 100644 index 000000000000..1cb32df1f833 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/index.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + +
Loading...
+ +
+ An unhandled error has occurred. + Reload + 🗙 +
+ + + + + + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/manifest.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/manifest.json new file mode 100644 index 000000000000..9548c2f65e18 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/manifest.json @@ -0,0 +1,16 @@ +{ + "name": "EmptyComponentsWebAssembly-CSharp", + "short_name": "EmptyComponentsWebAssembly-CSharp", + "start_url": "./", + "display": "standalone", + "background_color": "#ffffff", + "theme_color": "#03173d", + "prefer_related_applications": false, + "icons": [ + { + "src": "icon-512.png", + "type": "image/png", + "sizes": "512x512" + } + ] +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/service-worker.js b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/service-worker.js new file mode 100644 index 000000000000..fe614daee090 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/service-worker.js @@ -0,0 +1,4 @@ +// In development, always fetch from the network and do not enable offline support. +// This is because caching would make development more difficult (changes would not +// be reflected on the first load after each change). +self.addEventListener('fetch', () => { }); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/service-worker.published.js b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/service-worker.published.js new file mode 100644 index 000000000000..e44e13a3266f --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/service-worker.published.js @@ -0,0 +1,59 @@ +// Caution! Be sure you understand the caveats before publishing an application with +// offline support. See https://aka.ms/blazor-offline-considerations + +self.importScripts('./service-worker-assets.js'); +self.addEventListener('install', event => event.waitUntil(onInstall(event))); +self.addEventListener('activate', event => event.waitUntil(onActivate(event))); +self.addEventListener('fetch', event => event.respondWith(onFetch(event))); + +const cacheNamePrefix = 'offline-cache-'; +const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`; +const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ]; +const offlineAssetsExclude = [ /^service-worker\.js$/ ]; + +async function onInstall(event) { + console.info('Service worker: Install'); + + // Fetch and cache all matching items from the assets manifest + const assetsRequests = self.assetsManifest.assets + .filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url))) + .filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url))) + .map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' })); +//#if(Hosted) + + // Also cache authentication configuration + assetsRequests.push(new Request('_configuration/EmptyComponentsWebAssembly-CSharp.Client')); + +//#endif + await caches.open(cacheName).then(cache => cache.addAll(assetsRequests)); +} + +async function onActivate(event) { + console.info('Service worker: Activate'); + + // Delete unused caches + const cacheKeys = await caches.keys(); + await Promise.all(cacheKeys + .filter(key => key.startsWith(cacheNamePrefix) && key !== cacheName) + .map(key => caches.delete(key))); +} + +async function onFetch(event) { + let cachedResponse = null; + if (event.request.method === 'GET') { + // For all navigation requests, try to serve index.html from cache + // If you need some URLs to be server-rendered, edit the following check to exclude those URLs +//#if(Hosted) + const shouldServeIndexHtml = event.request.mode === 'navigate' + && !event.request.url.includes('/connect/') +//#else + const shouldServeIndexHtml = event.request.mode === 'navigate'; +//#endif + + const request = shouldServeIndexHtml ? 'index.html' : event.request; + const cache = await caches.open(cacheName); + cachedResponse = await cache.match(request); + } + + return cachedResponse || fetch(event.request); +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/EmptyComponentsWebAssembly-CSharp.sln b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/EmptyComponentsWebAssembly-CSharp.sln new file mode 100644 index 000000000000..f30f423de240 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/EmptyComponentsWebAssembly-CSharp.sln @@ -0,0 +1,64 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.0.0 +MinimumVisualStudioVersion = 16.0.0.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmptyComponentsWebAssembly-CSharp.Server", "Server\EmptyComponentsWebAssembly-CSharp.Server.csproj", "{650B3CE7-2E93-4CC4-9F46-466686815EAA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmptyComponentsWebAssembly-CSharp.Client", "Client\EmptyComponentsWebAssembly-CSharp.Client.csproj", "{5990939C-7E7B-4CFA-86FF-44CA5756498A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmptyComponentsWebAssembly-CSharp.Shared", "Shared\EmptyComponentsWebAssembly-CSharp.Shared.csproj", "{0AFFA7FD-4E37-4636-AB91-3753E746DB98}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x64.ActiveCfg = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x64.Build.0 = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x86.ActiveCfg = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x86.Build.0 = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|Any CPU.Build.0 = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x64.ActiveCfg = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x64.Build.0 = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x86.ActiveCfg = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x86.Build.0 = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x64.ActiveCfg = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x64.Build.0 = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x86.ActiveCfg = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x86.Build.0 = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|Any CPU.Build.0 = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x64.ActiveCfg = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x64.Build.0 = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x86.ActiveCfg = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x86.Build.0 = Release|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Debug|x64.ActiveCfg = Debug|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Debug|x64.Build.0 = Debug|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Debug|x86.ActiveCfg = Debug|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Debug|x86.Build.0 = Debug|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Release|Any CPU.Build.0 = Release|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Release|x64.ActiveCfg = Release|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Release|x64.Build.0 = Release|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Release|x86.ActiveCfg = Release|Any CPU + {0AFFA7FD-4E37-4636-AB91-3753E746DB98}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4C26868E-5E7C-458D-82E3-040509D0C71F} + EndGlobalSection +EndGlobal diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/Program.cs new file mode 100644 index 000000000000..a8e63acaf0b8 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/Program.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.ResponseCompression; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddControllersWithViews(); +builder.Services.AddRazorPages(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseWebAssemblyDebugging(); +} +#if (HasHttpsProfile) +else +{ + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); +#endif +app.UseBlazorFrameworkFiles(); +app.UseStaticFiles(); + +app.UseRouting(); + +app.MapRazorPages(); +app.MapControllers(); +app.MapFallbackToFile("index.html"); + +app.Run(); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/Properties/launchSettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/Properties/launchSettings.json new file mode 100644 index 000000000000..084a9762a299 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/Properties/launchSettings.json @@ -0,0 +1,44 @@ +{ + "iisExpress": { + "applicationUrl": "http://localhost:8080", + //#if (HasHttpsProfile) + "sslPort": 44300 + //#else + "sslPort": 0 + //#endif + }, + "profiles": { + //#if (HasHttpProfile) + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + //#endif + //#if (HasHttpsProfile) + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + //#endif + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/appsettings.Development.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/appsettings.Development.json new file mode 100644 index 000000000000..0c208ae9181e --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/appsettings.json new file mode 100644 index 000000000000..10f68b8c8b4f --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Server/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Shared/SharedClass.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Shared/SharedClass.cs new file mode 100644 index 000000000000..bb016a89ade4 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Shared/SharedClass.cs @@ -0,0 +1 @@ +/* Shared classes can be referenced by both the Client and Server */ diff --git a/src/ProjectTemplates/test/Templates.Blazor.Tests/EmptyBlazorWasmTemplateTest.cs b/src/ProjectTemplates/test/Templates.Blazor.Tests/EmptyBlazorWasmTemplateTest.cs new file mode 100644 index 000000000000..9d9fa410570a --- /dev/null +++ b/src/ProjectTemplates/test/Templates.Blazor.Tests/EmptyBlazorWasmTemplateTest.cs @@ -0,0 +1,114 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing; +using Newtonsoft.Json.Linq; +using Templates.Test.Helpers; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace Templates.Blazor.Test; + +public class EmptyBlazorWasmTemplateTest : BlazorTemplateTest +{ + public EmptyBlazorWasmTemplateTest(ProjectFactoryFixture projectFactory) + : base(projectFactory) { } + + public override string ProjectType { get; } = "blazorwasm-empty"; + + [Fact] + public async Task EmptyBlazorWasmStandaloneTemplateCanCreateBuildPublish() + { + var project = await CreateBuildPublishAsync(); + + // The service worker assets manifest isn't generated for non-PWA projects + var publishDir = Path.Combine(project.TemplatePublishDir, "wwwroot"); + Assert.False(File.Exists(Path.Combine(publishDir, "service-worker-assets.js")), "Non-PWA templates should not produce service-worker-assets.js"); + } + + [Fact] + public async Task EmptyBlazorWasmStandaloneTemplateNoHttpsCanCreateBuildPublish() + { + var project = await CreateBuildPublishAsync(args: new[] { ArgConstants.NoHttps }); + + // The service worker assets manifest isn't generated for non-PWA projects + var publishDir = Path.Combine(project.TemplatePublishDir, "wwwroot"); + Assert.False(File.Exists(Path.Combine(publishDir, "service-worker-assets.js")), "Non-PWA templates should not produce service-worker-assets.js"); + } + + [Fact] + public Task EmptyBlazorWasmHostedTemplateCanCreateBuildPublish() + => CreateBuildPublishAsync(args: new[] { ArgConstants.Hosted }, serverProject: true); + + [Fact] + public Task EmptyBlazorWasmHostedTemplateNoHttpsCanCreateBuildPublish() + => CreateBuildPublishAsync(args: new[] { ArgConstants.Hosted, ArgConstants.NoHttps }, serverProject: true); + + [Fact] + public Task EmptyBlazorWasmStandalonePwaTemplateCanCreateBuildPublish() + => CreateBuildPublishAsync(args: new[] { ArgConstants.Pwa }); + + [Fact] + public Task EmptyBlazorWasmStandalonePwaTemplateNoHttpsCanCreateBuildPublish() + => CreateBuildPublishAsync(args: new[] { ArgConstants.Pwa, ArgConstants.NoHttps }); + + [Fact] + public async Task EmptyBlazorWasmHostedPwaTemplateCanCreateBuildPublish() + { + var project = await CreateBuildPublishAsync(args: new[] { ArgConstants.Hosted, ArgConstants.Pwa }, serverProject: true); + + var serverProject = GetSubProject(project, "Server", $"{project.ProjectName}.Server"); + + ValidatePublishedServiceWorker(serverProject); + } + + [Fact] + public async Task EmptyBlazorWasmHostedPwaTemplateNoHttpsCanCreateBuildPublish() + { + var project = await CreateBuildPublishAsync(args: new[] { ArgConstants.Hosted, ArgConstants.Pwa, ArgConstants.NoHttps }, serverProject: true); + + var serverProject = GetSubProject(project, "Server", $"{project.ProjectName}.Server"); + + ValidatePublishedServiceWorker(serverProject); + } + + private void ValidatePublishedServiceWorker(Project project) + { + var publishDir = Path.Combine(project.TemplatePublishDir, "wwwroot"); + + // When publishing the PWA template, we generate an assets manifest + // and move service-worker.published.js to overwrite service-worker.js + Assert.False(File.Exists(Path.Combine(publishDir, "service-worker.published.js")), "service-worker.published.js should not be published"); + Assert.True(File.Exists(Path.Combine(publishDir, "service-worker.js")), "service-worker.js should be published"); + Assert.True(File.Exists(Path.Combine(publishDir, "service-worker-assets.js")), "service-worker-assets.js should be published"); + + // We automatically append the SWAM version as a comment in the published service worker file + var serviceWorkerAssetsManifestContents = ReadFile(publishDir, "service-worker-assets.js"); + var serviceWorkerContents = ReadFile(publishDir, "service-worker.js"); + + // Parse the "version": "..." value from the SWAM, and check it's in the service worker + var serviceWorkerAssetsManifestVersionMatch = new Regex(@"^\s*\""version\"":\s*(\""[^\""]+\"")", RegexOptions.Multiline) + .Match(serviceWorkerAssetsManifestContents); + Assert.True(serviceWorkerAssetsManifestVersionMatch.Success); + var serviceWorkerAssetsManifestVersionJson = serviceWorkerAssetsManifestVersionMatch.Groups[1].Captures[0].Value; + var serviceWorkerAssetsManifestVersion = JsonSerializer.Deserialize(serviceWorkerAssetsManifestVersionJson); + Assert.True(serviceWorkerContents.Contains($"/* Manifest version: {serviceWorkerAssetsManifestVersion} */", StringComparison.Ordinal)); + } + + private string ReadFile(string basePath, string path) + { + var fullPath = Path.Combine(basePath, path); + var doesExist = File.Exists(fullPath); + + Assert.True(doesExist, $"Expected file to exist, but it doesn't: {path}"); + return File.ReadAllText(Path.Combine(basePath, path)); + } +} diff --git a/src/ProjectTemplates/test/Templates.Tests/template-baselines.json b/src/ProjectTemplates/test/Templates.Tests/template-baselines.json index f2a584d6fd13..f1231f490d9f 100644 --- a/src/ProjectTemplates/test/Templates.Tests/template-baselines.json +++ b/src/ProjectTemplates/test/Templates.Tests/template-baselines.json @@ -1689,5 +1689,108 @@ "Program.cs" ] } + }, + "blazorwasm-empty": { + "None": { + "Template": "blazorwasm-empty", + "Arguments": "new blazorwasm-empty", + "Files": [ + "Pages/Index.razor", + "Properties/launchSettings.json", + "wwwroot/css/app.css", + "wwwroot/index.html", + "_Imports.razor", + "App.razor", + "MainLayout.razor", + "Program.cs" + ] + }, + "Hosted": { + "Template": "blazorwasm-empty", + "Arguments": "new blazorwasm-empty --hosted", + "Files": [ + "Client/_Imports.razor", + "Client/App.razor", + "Client/MainLayout.razor", + "Client/Program.cs", + "Client/Pages/Index.razor", + "Client/Properties/launchSettings.json", + "Client/wwwroot/index.html", + "Client/wwwroot/css/app.css", + "Server/Properties/launchSettings.json", + "Server/appsettings.Development.json", + "Server/appsettings.json", + "Server/Program.cs", + "Shared/SharedClass.cs" + ] + }, + "PWA": { + "Template": "blazorwasm-empty", + "Arguments": "new blazorwasm-empty --pwa", + "Files": [ + "Pages/Index.razor", + "Properties/launchSettings.json", + "wwwroot/css/app.css", + "wwwroot/icon-512.png", + "wwwroot/index.html", + "wwwroot/manifest.json", + "wwwroot/service-worker.js", + "wwwroot/service-worker.published.js", + "_Imports.razor", + "App.razor", + "MainLayout.razor", + "Program.cs" + ] + }, + "NoHttps": { + "Template": "blazorwasm-empty", + "Arguments": "new blazorwasm-empty --no-https", + "Files": [ + "Pages/Index.razor", + "Properties/launchSettings.json", + "wwwroot/css/app.css", + "wwwroot/index.html", + "_Imports.razor", + "App.razor", + "MainLayout.razor", + "Program.cs" + ] + }, + "PWAHosted": { + "Template": "blazorwasm-empty", + "Arguments": "new blazorwasm-empty --pwa --hosted", + "Files": [ + "Client/_Imports.razor", + "Client/App.razor", + "Client/MainLayout.razor", + "Client/Program.cs", + "Client/Pages/Index.razor", + "Client/Properties/launchSettings.json", + "Client/wwwroot/icon-512.png", + "Client/wwwroot/index.html", + "Client/wwwroot/manifest.json", + "Client/wwwroot/service-worker.js", + "Client/wwwroot/service-worker.published.js", + "Client/wwwroot/css/app.css", + "Server/Properties/launchSettings.json", + "Server/appsettings.Development.json", + "Server/appsettings.json", + "Server/Program.cs", + "Shared/SharedClass.cs" + ], + "ExcludeLaunchSettings": { + "Template": "blazorwasm-empty", + "Arguments": "new blazorwasm-empty --exclude-launch-settings", + "Files": [ + "Pages/Index.razor", + "wwwroot/css/app.css", + "wwwroot/index.html", + "_Imports.razor", + "App.razor", + "MainLayout.razor", + "Program.cs" + ] + } + } } }