Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does VS Code support server-side code in ASPX files?

When I open an ASPX (ASP.NET Web Forms) file with embedded server-side code in Visual Studio Code, I am getting a lot of error highlights.

Here is a very minimal example: ASPX in VSCode

Is there an extension I should have installed (I did install the C# extension) or is this an unsupported scenario? Or am I just really messing up here?

like image 402
Peter Avatar asked Aug 09 '17 08:08

Peter


People also ask

How can I see the code behind ASPX?

Right-click the . aspx page, and then click View Code. The code-behind file opens in the editor.

Does ASPX need to be compiled?

aspx. cs file) must first be compiled. This compilation can happen explicitly or automatically. If the compilation happens explicitly then the entire application's source code is compiled into one or more assemblies ( .

How do I add ASPX page to Visual Studio?

Select the Visual C# -> Web templates group on the left. Then, select Web Form from the middle list and name it FirstWebPage. aspx. Click Add to add the web page to your project.


1 Answers

VSCode is built to support .NET Core apps. .NET Core does not support ASP.NET Web Forms (and they probably never will). As noted correctly it is evaluated as HTML instead now.

That said, I don't think the issue in particular is VSCode, but more the compiler that isn't implemented to support Web Forms. I guess they just left out support for the ASPX syntax out of VSCode for that reason.

like image 69
Patrick Hofman Avatar answered Sep 19 '22 12:09

Patrick Hofman