London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
https://learn.microsoft.com/en-us/aspnet/core/mvc/advanced/app-parts?view=aspnetcore-7.0
You need to add the assembly to the application parrts.
public void ConfigureServices(IServiceCollection services)
{
var assembly = typeof(MySharedController).Assembly;
services.AddControllersWithViews()
.AddApplicationPart(assembly)
.AddRazorRuntimeCompilation();
services.Configure<MvcRazorRuntimeCompilationOptions>(options =>
{ options.FileProviders.Add(new EmbeddedFileProvider(assembly)); });
}
Thank you Mark,
Works like charm. I also had to add
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="3.1.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.0.0" />
</ItemGroup>
to the project file main.csproj and the paths to the template-files in the shared.csproj. But thanks to the link I found these dependencies
Have a great 2023
Hi all,
I'm trying to split up my project into multiple projects for reusage in different solutions.
After including the dependencies and building the main optimizely project I can choose the pageTypes and or blocks, but then the views are not found:
The same happens, when placing the "image" block on a working page (not StandardPage)
There the "Components/ImageBlock" is added somehow.
Do I have to create some links inside myOptimizely project. This would destroy my modular solution.
Have a happy new Year