The example "ASP.Net Core Web Application" ported from C# to Visual Basic
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Controllers
Models Add Views Models and bundleconfig Aug 20, 2017
Views Move to ASP.NET 2.0 to 2.1 Aug 18, 2018
wwwroot Move to ASP.NET 2.0 to 2.1 Aug 18, 2018
.gitignore Add Visual Studio generated files to gitignore Aug 20, 2017
App.vbproj Move to ASP.NET 2.0 to 2.1 Aug 18, 2018
LICENSE Move to ASP.NET 2.0 to 2.1 Aug 18, 2018
Program.vb Move to ASP.NET 2.0 to 2.1 Aug 18, 2018
README.md
StartUp.vb Move to ASP.NET 2.0 to 2.1 Aug 18, 2018
appsettings.json

README.md

ASP.Net Core Web Application in Visual Basic

I ported the example "ASP.Net Core Web Application" from C# to VB.net. It is (successfully) using Razor .cshtml files in a VB project. I have ensured it is compatible with ASP.Net Core 2.1.

When you run this code using 'dotnet run' you will encounter:

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
    An unhandled exception has occurred while executing the request.
Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred:
wjrfi1bi.4iy(1,1): error CS8301: Invalid name for a preprocessing symbol; ',NETCOREAPP,NETCOREAPP2_1' is not a valid identifier
at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(RazorCodeDocument codeDocument, String generatedCode)
at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath)
at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.OnCacheMiss(String normalizedPath)
--- End of stack trace from previous location where exception was thrown ---

Due to the file 'bin/Debug/netcoreapp2.1/App.deps.json' having:

{
    "runtimeTarget": {
        "name": ".NETCoreApp,Version=v2.1",
        "signature": "8d19439ef22c432fe18f0eac697c8789fe30c00a"
    },
    "compilationOptions": {
        "defines": [
        ",NETCOREAPP,NETCOREAPP2_1"

Remove ,NETCOREAPP, (including the commas) in the last line and run again with 'dotnet run'.

Other than that it seems to work with cshtml, as there seems to be no vbhtml support yet.