1
votes

I would like to create a new F# Web ASPNET (not Core) Application using the MSBuild based legacy project format, not the SDK project. In Visual Studio 2019, the only available option for this project type is C#. I've attempted to reverse engineer the project setup by creating a new F# class library and modify the ProjectTypeGuids.

The C# Web Application uses the following project type GUIDs

  • 349c5851-65df-11da-9384-00065b846f21 - ASP.NET MVC 5
  • fae04ec0-301f-11d3-bf4b-00c04f79efbc - C#

On a basic F# .NET Framework class library, I attempted to add the ASP.NET and F# project type guids to the project.

<ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{F2A71F9B-5D33-465A-A702-920D77279786}</ProjectTypeGuids>

This succeeded in adding the web configuration to the project properties, but now I am unable to add any items to the project at all. It looks like in the past you needed to associate the right language templates with the project guid in the registry editor (see this link)

These entries don't appear to be anywhere that I can see in the registry, for any installed version of VS (which at this point is just 2017 and 2019). How can I enable F# item templates for my F# web application?

1
Just a note - both SDK-style and "big project file"-style are MSBuild based. Is there a reason you want to use the old style project files? You can retarget a .NET Core project to .NET Framework and, if there references are correct, it'll build and run as you'd expect.Phillip Carter
@PhillipCarter I started with an SDK project targeting net48, and manually installing any frameworks / references, but could not get visual studio to launch the app properly. Unless I'm misunderstanding something I'm not sure that the new project system supports legacy aspnet projects yet stackoverflow.com/questions/49076273/…mclark1129
Aha, yes that's correct; there is no support for legacy web stuff in SDK-style projects. Is this something that you need to use? There's also no support for it in F# projects. I'd recommend moving to ASP.NET Core.Phillip Carter
Believe me, if I could do this in core I would! Unfortunately I have a constraint that I need to leverage the forms auth cookie from another app, and core has abandoned support for machine key decryption so I'm a bit stuck for now. I think I might just have to keep the web app C#, but still push as much of the actual logic into F# as possible.mclark1129
Your thinking here is probably the right call. Unfortunately, the tooling support you'd get with a hacked-together project in F# with legacy web stuff might not be worth the trouble. Various little things could break over time causing a lot of needless frustration.Phillip Carter

1 Answers

0
votes

While not exactly an answer to the question, I think the pain of trying to do this is likely proof that you SHOULDN'T do this. In the end my approach will be to simply implement the Web Application in C#, while keeping as much code as possible in F# targeting netstandard.