Skip to content

spencer-wcri/AspSidebySide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asp Side-by-Side

Demonstrate a C# Asp.net project loading controllers and views from an F# Asp.Net project.

This will help migrate from C# controllers to F# controllers

Leaned heavily on on Asp.net documentation

In short it comes down to

  • Making the views embedded resources
  • Registering an embedded file provider for the F# assembly
  • Registering an application part for the F# assembly

In Mvc.FSharp.fsproj

  <ItemGroup>
    <EmbeddedResource Include="Views/**/*.cshtml" />
  </ItemGroup>

In Mvc.CSharp > Program.cs

builder.Services
    .AddControllersWithViews()
    .AddApplicationPart(fsharpAssembly)
    .AddRazorRuntimeCompilation();


builder.Services.Configure<MvcRazorRuntimeCompilationOptions>(options =>
{ options.FileProviders.Add(new EmbeddedFileProvider(fsharpAssembly)); });

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published