forked from dotnet/aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* static assets problem when changing wwwroot * static assets problem when changing wwwroot
- Loading branch information
1 parent
d5cf0e4
commit 7e5a495
Showing
8 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(); |
30 changes: 30 additions & 0 deletions
30
fundamentals/static-files/WebRoot/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Remove="wwwroot\**" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="wwwroot-custom\Index.html"> | ||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> | ||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.1.32228.430 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebRoot", "WebRoot.csproj", "{E2E98526-6D6C-4A2A-861A-93F288983C4F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E2E98526-6D6C-4A2A-861A-93F288983C4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E2E98526-6D6C-4A2A-861A-93F288983C4F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E2E98526-6D6C-4A2A-861A-93F288983C4F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E2E98526-6D6C-4A2A-861A-93F288983C4F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {EFCDA9A5-B0F5-49E0-B732-19C61C4BFC13} | ||
EndGlobalSection | ||
EndGlobal |
8 changes: 8 additions & 0 deletions
8
fundamentals/static-files/WebRoot/appsettings.Development.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>custom</title> | ||
</head> | ||
<body> | ||
<h1>From custom wwwroot</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>wwwroot</title> | ||
</head> | ||
<body> | ||
<h1>From wwwroot</h1> | ||
</body> | ||
</html> |