Skip to content

Commit 7e5a495

Browse files
Static ww wroot/ra (dotnet#2)
* static assets problem when changing wwwroot * static assets problem when changing wwwroot
1 parent d5cf0e4 commit 7e5a495

File tree

8 files changed

+131
-0
lines changed

8 files changed

+131
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
2+
{
3+
Args = args,
4+
// Examine Hosting environment: logging value
5+
EnvironmentName = Environments.Staging,
6+
// Look for static files in "wwwroot-custom"
7+
WebRootPath = "wwwroot-custom"
8+
});
9+
10+
var app = builder.Build();
11+
12+
app.Logger.LogInformation("ASPNETCORE_ENVIRONMENT: {env}",
13+
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"));
14+
15+
app.Logger.LogInformation("app.Environment.IsDevelopment(): {env}",
16+
app.Environment.IsDevelopment().ToString());
17+
18+
app.UseDefaultFiles();
19+
app.UseStaticFiles();
20+
21+
app.Run();
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:2483",
7+
"sslPort": 44302
8+
}
9+
},
10+
"profiles": {
11+
"WebRoot": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
14+
"launchBrowser": true,
15+
"applicationUrl": "https://localhost:7006;http://localhost:5006",
16+
"environmentVariables": {
17+
"ASPNETCORE_ENVIRONMENT": "Development"
18+
//,"ASPNETCORE_ENVIRONMENT": "Production"
19+
}
20+
},
21+
"IIS Express": {
22+
"commandName": "IISExpress",
23+
"launchBrowser": true,
24+
"environmentVariables": {
25+
"ASPNETCORE_ENVIRONMENT": "Development"
26+
//,"ASPNETCORE_ENVIRONMENT": "Production"
27+
}
28+
}
29+
}
30+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<Content Remove="wwwroot\**" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<Content Include="wwwroot-custom\Index.html">
15+
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
16+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
17+
</Content>
18+
</ItemGroup>
19+
20+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32228.430
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebRoot", "WebRoot.csproj", "{E2E98526-6D6C-4A2A-861A-93F288983C4F}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{E2E98526-6D6C-4A2A-861A-93F288983C4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E2E98526-6D6C-4A2A-861A-93F288983C4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E2E98526-6D6C-4A2A-861A-93F288983C4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{E2E98526-6D6C-4A2A-861A-93F288983C4F}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {EFCDA9A5-B0F5-49E0-B732-19C61C4BFC13}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
},
8+
"AllowedHosts": "*"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>custom</title>
5+
</head>
6+
<body>
7+
<h1>From custom wwwroot</h1>
8+
</body>
9+
</html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>wwwroot</title>
5+
</head>
6+
<body>
7+
<h1>From wwwroot</h1>
8+
</body>
9+
</html>

0 commit comments

Comments
 (0)