Namespace not defined in F # ASP.NET MVC project in VS Code
I am currently trying to make some progress in learning F # and web development, and to that end, I used Yeoman to create an ASP.NET F # project to start with ( generator ).
I've used Bower to install the dependencies and the project both builds and runs without issue, both in VS Code and with dotnet run
. However, moving on to Startup.fs, it states that these namespaces are undefined:
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection
open Microsoft.Extensions.Logging
The following packages are included in the .fsproj file and I ran dotnet restore
:
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*" PrivateAssets="All"/>
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3"/>
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.2"/>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2"/>
<PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023"/>
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1"/>
In my opinion, these lines should include at least some of the relevant NuGet packages for the namespace above. I would like to know how to let VS Code see that these namespaces are defined in packages, and what is currently not the case. Any insight would be appreciated.
source to share
From the comments in the question of moving my comment to the answer:
I haven't used F # with core, but I noticed that you have a link
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*" PrivateAssets="All"/>
<PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023"/>.
I have the .net core 2 preview set and creating a new web project using the dotnet command generated by the link to
<PackageReference Include="FSharp.Core" Version="4.1.*" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
which has no problem in VS Code
source to share