diff --git a/.vscode/launch.json b/.vscode/launch.json
index 654bf081e77..542d31f6664 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -1,28 +1,25 @@
{
"version": "0.2.0",
- "configurations": [
+ "inputs": [
{
- "name": ".NET Core Launch (console debug) - net10.0",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "dotnet build (debug) - net10.0",
- "program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Debug/net10.0/OrchardCore.Cms.Web.dll",
- "args": [],
- "cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web",
- "env": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "stopAtEntry": false
- },
+ "id": "targetFramework",
+ "type": "pickString",
+ "description": "Select target framework",
+ "options": [
+ "net10.0"
+ ],
+ "default": "net10.0"
+ }
+ ],
+ "configurations": [
{
- "name": ".NET Core Launch (web debug) - net10.0",
+ "name": "Launch (debug)",
"type": "coreclr",
"request": "launch",
- "internalConsoleOptions": "openOnSessionStart",
- "preLaunchTask": "dotnet build (debug) - net10.0",
- "program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Debug/net10.0/OrchardCore.Cms.Web.dll",
+ "preLaunchTask": "dotnet build (debug)",
+ "program": "${workspaceFolder}/src/OrchardCore.Cms.Web/bin/Debug/${input:targetFramework}/OrchardCore.Cms.Web.dll",
"args": [],
- "cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web",
+ "cwd": "${workspaceFolder}/src/OrchardCore.Cms.Web",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
@@ -33,13 +30,13 @@
}
},
{
- "name": ".NET Core Launch (web release) - net10.0",
+ "name": "Launch (release)",
"type": "coreclr",
"request": "launch",
- "preLaunchTask": "dotnet build (release) - net10.0",
- "program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Release/net10.0/OrchardCore.Cms.Web.dll",
+ "preLaunchTask": "dotnet build (release)",
+ "program": "${workspaceFolder}/src/OrchardCore.Cms.Web/bin/Release/${input:targetFramework}/OrchardCore.Cms.Web.dll",
"args": [],
- "cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web",
+ "cwd": "${workspaceFolder}/src/OrchardCore.Cms.Web",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
@@ -50,25 +47,22 @@
}
},
{
- "name": ".NET Core Launch (web debug) - dotnet watch - net10.0",
- "type": "dotnetwatchattach",
+ "name": "Launch with Hot Reload (dotnet watch)",
+ "type": "node-terminal",
"request": "launch",
- "task": "dotnet watch - net10.0",
- "program": "OrchardCore.Cms.Web.exe",
- "args": {
- "env": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
+ "command": "dotnet watch --project src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj -f ${input:targetFramework}",
+ "cwd": "${workspaceFolder}",
+ "env": {
+ "ASPNETCORE_ENVIRONMENT": "Development",
+ "DOTNET_WATCH_SUPPRESS_LAUNCH_BROWSER": "true"
},
- "cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web",
- "stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
}
},
{
- "name": ".NET Core Attach",
+ "name": "Attach to Process",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 6edf4e23448..f019483d656 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -1,42 +1,69 @@
{
"version": "2.0.0",
- "linux": {
- "command": "sh",
- "args": [
- "-c"
- ]
- },
- "osx": {
- "command": "sh",
- "args": [
- "-c"
- ]
- },
- "windows": {
- "options": {
- "shell": {
- "executable": "cmd.exe",
- "args": [
- "/C"
- ]
- }
+ "inputs": [
+ {
+ "id": "targetFramework",
+ "type": "pickString",
+ "description": "Select target framework",
+ "options": [
+ "net10.0"
+ ],
+ "default": "net10.0"
}
- },
+ ],
"tasks": [
{
- "label": "dotnet watch - net10.0",
+ "label": "dotnet watch",
"type": "process",
"command": "dotnet",
"args": [
"watch",
- "run",
- "${workspaceRoot}/src/OrchardCore.Cms.Web",
+ "--project",
+ "${workspaceFolder}/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj",
"-f",
- "net10.0"
+ "${input:targetFramework}"
],
"options": {
- "cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web"
+ "env": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
},
+ "isBackground": true,
+ "problemMatcher": {
+ "base": "$msCompile",
+ "background": {
+ "activeOnStart": true,
+ "beginsPattern": "dotnet watch",
+ "endsPattern": "\\bNow listening on:\\s+(https?://\\S+)"
+ }
+ }
+ },
+ {
+ "label": "dotnet build (debug)",
+ "type": "shell",
+ "command": "dotnet",
+ "args": [
+ "build",
+ "${workspaceFolder}/src/OrchardCore.Cms.Web",
+ "-c",
+ "Debug",
+ "-f",
+ "${input:targetFramework}"
+ ],
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "dotnet build (release)",
+ "type": "shell",
+ "command": "dotnet",
+ "args": [
+ "build",
+ "${workspaceFolder}/src/OrchardCore.Cms.Web",
+ "-c",
+ "Release",
+ "-f",
+ "${input:targetFramework}"
+ ],
"problemMatcher": "$msCompile"
},
{
@@ -46,9 +73,9 @@
"args": [
"run",
"--project",
- "${workspaceRoot}\\src\\OrchardCore.Cms.Web\\OrchardCore.Cms.Web.csproj",
+ "${workspaceFolder}/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj",
"-f",
- "net10.0"
+ "${input:targetFramework}"
]
},
{
@@ -89,60 +116,32 @@
]
},
{
- "label": "dotnet build (debug) - net10.0",
- "type": "shell",
- "command": "dotnet",
- "args": [
- "build",
- "${workspaceRoot}/src/OrchardCore.Cms.Web",
- "-c",
- "Debug",
- "-f",
- "net10.0"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "dotnet build (release) - net10.0",
+ "label": "dotnet rebuild (debug)",
"type": "shell",
"command": "dotnet",
"args": [
"build",
- "${workspaceRoot}/src/OrchardCore.Cms.Web",
- "-c",
- "Release",
- "-f",
- "net10.0"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "dotnet rebuild (debug) - net10.0",
- "type": "shell",
- "command": "dotnet",
- "args": [
- "build",
- "${workspaceRoot}/src/OrchardCore.Cms.Web",
+ "${workspaceFolder}/src/OrchardCore.Cms.Web",
"--no-incremental",
"-c",
"Debug",
"-f",
- "net10.0"
+ "${input:targetFramework}"
],
"problemMatcher": "$msCompile"
},
{
- "label": "dotnet rebuild (release) - net10.0",
+ "label": "dotnet rebuild (release)",
"type": "shell",
"command": "dotnet",
"args": [
"build",
- "${workspaceRoot}/src/OrchardCore.Cms.Web",
+ "${workspaceFolder}/src/OrchardCore.Cms.Web",
"--no-incremental",
"-c",
"Release",
"-f",
- "net10.0"
+ "${input:targetFramework}"
],
"problemMatcher": "$msCompile"
},
@@ -153,59 +152,59 @@
"windows": {
"command": "Remove-Item",
"args": [
- "${workspaceRoot}\\.build\\release\\*",
+ "${workspaceFolder}\\.build\\release\\*",
"-recurse"
]
},
"args": [
"-rfv",
- "${workspaceRoot}/.build/release/*"
+ "${workspaceFolder}/.build/release/*"
]
},
{
- "label": "dotnet publish (self-contained) - release - net10.0",
+ "label": "dotnet publish (self-contained) - release",
"type": "shell",
"command": "dotnet",
"windows": {
"command": "dotnet",
"args": [
"publish",
- "${workspaceRoot}\\src\\OrchardCore.Cms.Web",
+ "${workspaceFolder}\\src\\OrchardCore.Cms.Web",
"--configuration",
"release",
"--runtime",
"win-x64",
"--self-contained",
"--framework",
- "net10.0",
+ "${input:targetFramework}",
"--output",
".\\.build\\release"
]
},
"args": [
"publish",
- "${workspaceRoot}/src/OrchardCore.Cms.Web",
+ "${workspaceFolder}/src/OrchardCore.Cms.Web",
"--configuration",
"release",
"--runtime",
"linux-x64",
"--self-contained",
"--framework",
- "net10.0",
+ "${input:targetFramework}",
"--output",
"./.build/release"
],
"problemMatcher": "$msCompile"
},
{
- "label": "dotnet publish (framework dependent) - release - net10.0",
+ "label": "dotnet publish (framework dependent) - release",
"type": "shell",
"command": "dotnet",
"windows": {
"command": "dotnet",
"args": [
"publish",
- "${workspaceRoot}\\src\\OrchardCore.Cms.Web",
+ "${workspaceFolder}\\src\\OrchardCore.Cms.Web",
"--configuration",
"release",
"--runtime",
@@ -213,14 +212,14 @@
"--self-contained",
"false",
"--framework",
- "net10.0",
+ "${input:targetFramework}",
"--output",
".\\.build\\release"
]
},
"args": [
"publish",
- "${workspaceRoot}/src/OrchardCore.Cms.Web",
+ "${workspaceFolder}/src/OrchardCore.Cms.Web",
"--configuration",
"release",
"--runtime",
@@ -228,24 +227,24 @@
"--self-contained",
"false",
"--framework",
- "net10.0",
+ "${input:targetFramework}",
"--output",
"./.build/release"
],
"problemMatcher": "$msCompile"
},
{
- "label": "tasks: dotnet publish release (self-contained) - net10.0",
+ "label": "tasks: dotnet publish release (self-contained)",
"dependsOn": [
"cleanup publish folder",
- "dotnet publish (self-contained) - net10.0"
+ "dotnet publish (self-contained) - release"
]
},
{
- "label": "tasks: dotnet publish release (framework dependent) - net10.0",
+ "label": "tasks: dotnet publish release (framework dependent)",
"dependsOn": [
"cleanup publish folder",
- "dotnet publish (framework dependent) - net10.0"
+ "dotnet publish (framework dependent) - release"
]
},
{
diff --git a/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj b/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj
index ba42999a2ca..0c2380c332a 100644
--- a/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj
+++ b/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj
@@ -7,7 +7,6 @@
$(CommonTargetFrameworks)
612,618
InProcess
- false
enable
enable
diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/RazorCompilationFileProviderAccessor.cs b/src/OrchardCore/OrchardCore.Mvc.Core/RazorCompilationFileProviderAccessor.cs
deleted file mode 100644
index 8c2bd79485c..00000000000
--- a/src/OrchardCore/OrchardCore.Mvc.Core/RazorCompilationFileProviderAccessor.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using Microsoft.Extensions.FileProviders;
-using Microsoft.Extensions.Options;
-
-namespace OrchardCore.Mvc;
-
-// Note: MvcRazorRuntimeCompilationOptions is deprecated in .NET 10
-// This class is kept for backward compatibility but will be removed in future versions
-#pragma warning disable ASPDEPR003 // Razor runtime compilation is obsolete
-public class RazorCompilationFileProviderAccessor
-{
- private readonly Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.MvcRazorRuntimeCompilationOptions _options;
- private IFileProvider _compositeFileProvider;
-
- public RazorCompilationFileProviderAccessor(IOptions options)
- {
- ArgumentNullException.ThrowIfNull(options);
-
- _options = options.Value;
- }
-
- public IFileProvider FileProvider
- {
- get
- {
- _compositeFileProvider ??= GetCompositeFileProvider(_options);
-
- return _compositeFileProvider;
- }
- }
-
- private static IFileProvider GetCompositeFileProvider(Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.MvcRazorRuntimeCompilationOptions options)
- {
- var fileProviders = options.FileProviders;
-
- if (fileProviders.Count == 1)
- {
- return fileProviders[0];
- }
-
- return new CompositeFileProvider(fileProviders);
- }
-}
-#pragma warning restore ASPDEPR003
diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/RazorCompilationOptionsSetup.cs b/src/OrchardCore/OrchardCore.Mvc.Core/RazorCompilationOptionsSetup.cs
deleted file mode 100644
index 1e3125a0ff7..00000000000
--- a/src/OrchardCore/OrchardCore.Mvc.Core/RazorCompilationOptionsSetup.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Options;
-using OrchardCore.Modules;
-
-namespace OrchardCore.Mvc;
-
-// Note: MvcRazorRuntimeCompilationOptions is deprecated in .NET 10
-// This class is kept for backward compatibility but will be removed in future versions
-#pragma warning disable ASPDEPR003 // Razor runtime compilation is obsolete
-public sealed class RazorCompilationOptionsSetup : IConfigureOptions
-{
- private readonly IHostEnvironment _hostingEnvironment;
- private readonly IApplicationContext _applicationContext;
-
- public RazorCompilationOptionsSetup(IHostEnvironment hostingEnvironment, IApplicationContext applicationContext)
- {
- _hostingEnvironment = hostingEnvironment;
- _applicationContext = applicationContext;
- }
-
- public void Configure(Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.MvcRazorRuntimeCompilationOptions options)
- {
- // In dev mode or if there is no 'refs' folder, we don't register razor runtime compilation services.
- var refsFolderExists = Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "refs"));
-
- // But in some view location expanders we always use the file providers that we enlist here, so
- // we still need to add 'ContentRootFileProvider' that includes our 'ModuleEmbeddedFileProvider'.
- if (!_hostingEnvironment.IsDevelopment() || !refsFolderExists)
- {
- options.FileProviders.Insert(0, _hostingEnvironment.ContentRootFileProvider);
- }
-
- // To let the application behave as a module, its razor files are requested under the virtual
- // "Areas" folder, but they are still served from the file system by this custom provider.
- options.FileProviders.Insert(0, new ApplicationViewFileProvider(_applicationContext));
-
- if (_hostingEnvironment.IsDevelopment())
- {
- // While in development, razor files are 1st served from their module project locations.
- options.FileProviders.Insert(0, new ModuleProjectRazorFileProvider(_applicationContext));
- }
- }
-}
-#pragma warning restore ASPDEPR003
diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/SharedViewCompilerProvider.cs b/src/OrchardCore/OrchardCore.Mvc.Core/SharedViewCompilerProvider.cs
deleted file mode 100644
index 3dbaf58775d..00000000000
--- a/src/OrchardCore/OrchardCore.Mvc.Core/SharedViewCompilerProvider.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace OrchardCore.Mvc;
-
-///
-/// Shares across tenants the same .
-///
-public class SharedViewCompilerProvider : IViewCompilerProvider
-{
- private readonly object _synLock = new();
- private static IViewCompiler _compiler;
- private readonly IServiceProvider _services;
-
- public SharedViewCompilerProvider(IServiceProvider services)
- {
- _services = services;
- }
-
- public IViewCompiler GetCompiler()
- {
- if (_compiler is not null)
- {
- return _compiler;
- }
-
- lock (_synLock)
- {
- if (_compiler is not null)
- {
- return _compiler;
- }
-
- _compiler = _services
- .GetServices()
- .FirstOrDefault()
- ?.GetCompiler();
- }
-
- return _compiler;
- }
-}
diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/ShellViewFeatureProvider.cs b/src/OrchardCore/OrchardCore.Mvc.Core/ShellViewFeatureProvider.cs
index 6e49182174a..8c3a77d3ad5 100644
--- a/src/OrchardCore/OrchardCore.Mvc.Core/ShellViewFeatureProvider.cs
+++ b/src/OrchardCore/OrchardCore.Mvc.Core/ShellViewFeatureProvider.cs
@@ -9,7 +9,7 @@
namespace OrchardCore.Mvc;
-public class ShellViewFeatureProvider : IApplicationFeatureProvider, IApplicationFeatureProvider
+public class ShellViewFeatureProvider : IApplicationFeatureProvider
{
private readonly IHostEnvironment _hostingEnvironment;
private readonly IApplicationContext _applicationContext;
@@ -51,32 +51,6 @@ public void PopulateFeature(IEnumerable parts, ViewsFeature fea
}
}
- public void PopulateFeature(IEnumerable parts, DevelopmentViewsFeature developmentViewsFeature)
- {
- EnsureScopedServices();
-
- // Module compiled views are only served if not in dev mode or if the 'refs' folder doesn't exists.
- var refsFolderExists = Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "refs"));
-
- // But in dev mode we still provide all view descriptors.
- if (_hostingEnvironment.IsDevelopment() && refsFolderExists)
- {
- var viewsFeature = new ViewsFeature();
- PopulateFeatureInternal(viewsFeature);
-
- // Apply views feature providers registered at the tenant level.
- foreach (var provider in _featureProviders)
- {
- provider.PopulateFeature(parts, viewsFeature);
- }
-
- foreach (var descriptor in viewsFeature.ViewDescriptors)
- {
- developmentViewsFeature.ViewDescriptors.Add(descriptor);
- }
- }
- }
-
private void PopulateFeatureInternal(ViewsFeature feature)
{
// Retrieve mvc views feature providers but not this one.
@@ -87,21 +61,8 @@ private void PopulateFeatureInternal(ViewsFeature feature)
var modules = _applicationContext.Application.Modules;
var moduleFeature = new ViewsFeature();
- var refsFolderExists = Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "refs"));
-
foreach (var module in modules)
{
- // If the module and the application assemblies are at the same location, the module is referenced as a project not as a package.
- if (Path.GetDirectoryName(module.Assembly.Location) == Path.GetDirectoryName(_applicationContext.Application.Assembly.Location))
- {
- // If the module is referenced as a project, view descriptors are not provided if in dev mode and if the 'refs' folder exists.
- if (_hostingEnvironment.IsDevelopment() && refsFolderExists)
- {
- continue;
- }
- }
-
- // If the module is referenced as a package, view descriptors are always provided.
var assembliesWithViews = new List();
diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/Startup.cs b/src/OrchardCore/OrchardCore.Mvc.Core/Startup.cs
index 7f4dfc6c1ca..874ce885816 100644
--- a/src/OrchardCore/OrchardCore.Mvc.Core/Startup.cs
+++ b/src/OrchardCore/OrchardCore.Mvc.Core/Startup.cs
@@ -1,15 +1,16 @@
using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Razor;
-using Microsoft.AspNetCore.Mvc.Razor.Compilation;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using OrchardCore.Modules;
@@ -21,22 +22,38 @@
namespace OrchardCore.Mvc;
-public sealed class Startup : StartupBase
+public sealed class Startup : Modules.StartupBase
{
public override int Order => -1000;
public override int ConfigureOrder => 1000;
- private readonly IHostEnvironment _hostingEnvironment;
private readonly IServiceProvider _serviceProvider;
- public Startup(IHostEnvironment hostingEnvironment, IServiceProvider serviceProvider)
+ public Startup(IServiceProvider serviceProvider)
{
- _hostingEnvironment = hostingEnvironment;
_serviceProvider = serviceProvider;
}
public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
{
+ var env = serviceProvider.GetRequiredService();
+
+ if (env.IsDevelopment())
+ {
+ var appContext = serviceProvider.GetRequiredService();
+
+ // In development, add file providers for module project source directories
+ // so that Hot Reload can detect and apply changes to .cshtml files.
+ env.ContentRootFileProvider = new CompositeFileProvider(
+ new ModuleProjectRazorFileProvider(appContext),
+ new ApplicationViewFileProvider(appContext),
+ env.ContentRootFileProvider);
+
+ // Also update the web host's content root file provider.
+ serviceProvider.GetRequiredService()
+ .ContentRootFileProvider = env.ContentRootFileProvider;
+ }
+
var descriptors = serviceProvider.GetRequiredService()
.ActionDescriptors.Items
.OfType()
@@ -94,36 +111,7 @@ public override void ConfigureServices(IServiceCollection services)
services.AddTransient, ModularRazorViewEngineOptionsSetup>();
- if (_hostingEnvironment.IsDevelopment())
- {
- // Support razor runtime compilation only if in dev mode and if the 'refs' folder exists.
- var refsFolderExists = Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "refs"));
-
- if (refsFolderExists)
- {
- // Note: Razor runtime compilation is deprecated in .NET 10
- // For development scenarios, use Hot Reload instead
- // This is kept for backward compatibility but will be removed in future versions
-#pragma warning disable ASPDEPR003 // Razor runtime compilation is obsolete
- builder.AddRazorRuntimeCompilation();
-#pragma warning restore ASPDEPR003
- }
- }
- else
- {
- // Share across tenants a static compiler even if there is no runtime compilation
- // because the compiler still uses its internal cache to retrieve compiled items.
- // Register this provider only in production mode, as it may cause hot reload to fail in development mode.
- services.AddSingleton();
- }
-
- // Note: MvcRazorRuntimeCompilationOptions is deprecated in .NET 10
- // This configuration is kept for backward compatibility but will be removed in future versions
-#pragma warning disable ASPDEPR003 // Razor runtime compilation is obsolete
- services.AddTransient, RazorCompilationOptionsSetup>();
-#pragma warning restore ASPDEPR003
-
- services.AddSingleton();
+ services.AddSingleton();
// Note: IActionContextAccessor is deprecated in .NET 10 and will be removed
// ActionContext should be created when needed instead of using a global accessor
diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/ViewFileProviderAccessor.cs b/src/OrchardCore/OrchardCore.Mvc.Core/ViewFileProviderAccessor.cs
new file mode 100644
index 00000000000..214a1454546
--- /dev/null
+++ b/src/OrchardCore/OrchardCore.Mvc.Core/ViewFileProviderAccessor.cs
@@ -0,0 +1,24 @@
+using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.Hosting;
+using OrchardCore.Modules;
+
+namespace OrchardCore.Mvc;
+
+///
+/// Provides a composite that combines the application's view file
+/// provider with the content root file provider. Used by view location expanders to discover
+/// which modules have shared views.
+///
+public class ViewFileProviderAccessor
+{
+ public ViewFileProviderAccessor(
+ IHostEnvironment hostingEnvironment,
+ IApplicationContext applicationContext)
+ {
+ FileProvider = new CompositeFileProvider(
+ new ApplicationViewFileProvider(applicationContext),
+ hostingEnvironment.ContentRootFileProvider);
+ }
+
+ public IFileProvider FileProvider { get; }
+}
diff --git a/test/OrchardCore.Tests.Pages/OrchardCore.Application.Pages/OrchardCore.Application.Pages.csproj b/test/OrchardCore.Tests.Pages/OrchardCore.Application.Pages/OrchardCore.Application.Pages.csproj
index 45ae0b7c3ee..770d15c37a9 100644
--- a/test/OrchardCore.Tests.Pages/OrchardCore.Application.Pages/OrchardCore.Application.Pages.csproj
+++ b/test/OrchardCore.Tests.Pages/OrchardCore.Application.Pages/OrchardCore.Application.Pages.csproj
@@ -6,7 +6,6 @@
$(CommonTargetFrameworks)
InProcess
- false
$(NoWarn);EnableGenerateDocumentationFile
@@ -15,10 +14,6 @@
-
-
-
-