Over a million developers have joined DZone.

Adding New Items to a Pure F# ASP.NET MVC/Web API Project

·

A few months ago Mark Seemann put together a great post on how to create a pure F# ASP.NET Web API project. One of the biggest disadvantages mentioned in that post is that once the necessary changes are made to the ProjectTypeGuids element in the fsproj file, the Add New Item wizard no longer displays items. After much trial and error, I've found a fix for this issue.

Note: While the change mentioned here is pretty mild, the standard registry edit disclaimer still applies. It's recommended that you backup your registry before making changes as incorrect changes/additions/deletions can have serious and unexpected consequences.

Here are the steps for VS2013 (for VS2012 the steps should be similar, but with a slightly different registry path).

1. Edit the registry (e.g. run regedit.exe).

2. Locate HKEY_LOCAL_MACHINE or HKEY_LOCAL_USER then \SOFTWARE\Microsoft\VisualStudio\ then 12.0 or 12.0_Config then \Projects\

3. Find {349C5850-65DF-11DA-9384-00065B846F21}. If there is more than one, find the one with LanguageTemplates as the child. 

4. Add a new String Value entry to the LanguageTemplates node with a key and value of {F2A71F9B-5D33-465A-A702-920D77279786}.


5. Test it out by closing all instances of VS, creating a pure F# ASP.NET MVC or Web API project, and trying to add a new item. You should now see all of the usual F# item templates.


If you want to try this out without having to manually create a pure F# ASP.NET MVC or Web API project, here's a sneak peak of one of the F# Nancy templates that Ryan Riley and I are working on. Look for the full collection of F# Nancy templates in the next few weeks. You can get involved with the Nancy templates by contributing to https://github.com/fsharp/FSharpCommunityTemplates/tree/master/VisualStudio/Nancy.Templates

Topics:

Published at DZone with permission of Daniel Mohl, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}