简体   繁体   中英

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: VSCode 中的 ASPX

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?

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.

There is now an extension in the Marketplace called HTML (C#) which is a port from a Sublime plugin. I found it by searching for aspx in the Extensions sidebar. Picture of Marketplace Extension Search

Here's the link to the Github repo if that suits you better: https://github.com/fireside21/vscode-cshtml

Once that was loaded up I had no more errors from the incorrect assumption that I was editing a .js file.

Found this aspx-html extension that helped me a bit. Made those oooold aspx vbscript files readable at least. Google translate required though :)

"Provides syntax highlighting, parenthesis matching, and snippet functionality in the ASPX file."

https://marketplace.visualstudio.com/items?itemName=QQZZFT.aspx-html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM