From 7e5a495c29006dfbbeb39e141f5deaf8ca20c87b Mon Sep 17 00:00:00 2001
From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
Date: Wed, 30 Mar 2022 16:01:49 -1000
Subject: [PATCH] Static ww wroot/ra (#2)
* static assets problem when changing wwwroot
* static assets problem when changing wwwroot
---
fundamentals/static-files/WebRoot/Program.cs | 21 +++++++++++++
.../WebRoot/Properties/launchSettings.json | 30 +++++++++++++++++++
.../static-files/WebRoot/WebRoot.csproj | 20 +++++++++++++
fundamentals/static-files/WebRoot/WebRoot.sln | 25 ++++++++++++++++
.../WebRoot/appsettings.Development.json | 8 +++++
.../static-files/WebRoot/appsettings.json | 9 ++++++
.../WebRoot/wwwroot-custom/Index.html | 9 ++++++
.../static-files/WebRoot/wwwroot/Index.html | 9 ++++++
8 files changed, 131 insertions(+)
create mode 100644 fundamentals/static-files/WebRoot/Program.cs
create mode 100644 fundamentals/static-files/WebRoot/Properties/launchSettings.json
create mode 100644 fundamentals/static-files/WebRoot/WebRoot.csproj
create mode 100644 fundamentals/static-files/WebRoot/WebRoot.sln
create mode 100644 fundamentals/static-files/WebRoot/appsettings.Development.json
create mode 100644 fundamentals/static-files/WebRoot/appsettings.json
create mode 100644 fundamentals/static-files/WebRoot/wwwroot-custom/Index.html
create mode 100644 fundamentals/static-files/WebRoot/wwwroot/Index.html
diff --git a/fundamentals/static-files/WebRoot/Program.cs b/fundamentals/static-files/WebRoot/Program.cs
new file mode 100644
index 000000000000..9877e54dd8e2
--- /dev/null
+++ b/fundamentals/static-files/WebRoot/Program.cs
@@ -0,0 +1,21 @@
+var builder = WebApplication.CreateBuilder(new WebApplicationOptions
+{
+ Args = args,
+ // Examine Hosting environment: logging value
+ EnvironmentName = Environments.Staging,
+ // Look for static files in "wwwroot-custom"
+ WebRootPath = "wwwroot-custom"
+});
+
+var app = builder.Build();
+
+app.Logger.LogInformation("ASPNETCORE_ENVIRONMENT: {env}",
+ Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"));
+
+app.Logger.LogInformation("app.Environment.IsDevelopment(): {env}",
+ app.Environment.IsDevelopment().ToString());
+
+app.UseDefaultFiles();
+app.UseStaticFiles();
+
+app.Run();
diff --git a/fundamentals/static-files/WebRoot/Properties/launchSettings.json b/fundamentals/static-files/WebRoot/Properties/launchSettings.json
new file mode 100644
index 000000000000..6cbc47646ff3
--- /dev/null
+++ b/fundamentals/static-files/WebRoot/Properties/launchSettings.json
@@ -0,0 +1,30 @@
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:2483",
+ "sslPort": 44302
+ }
+ },
+ "profiles": {
+ "WebRoot": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:7006;http://localhost:5006",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ //,"ASPNETCORE_ENVIRONMENT": "Production"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ //,"ASPNETCORE_ENVIRONMENT": "Production"
+ }
+ }
+ }
+}
diff --git a/fundamentals/static-files/WebRoot/WebRoot.csproj b/fundamentals/static-files/WebRoot/WebRoot.csproj
new file mode 100644
index 000000000000..cae4bd2ba86e
--- /dev/null
+++ b/fundamentals/static-files/WebRoot/WebRoot.csproj
@@ -0,0 +1,20 @@
+