Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2022, I can't drag and drop css file into a cshtml file

I am working with VS2022 ASP.NET Core 6 MVC.

I tried to drag & drop one CSS file from explorer to a .cshtml file. It should be made automatically like this code the same way-VS 2019

<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />

But prohibition icon shown when I am trying the drag & drop operation.

I started again VS 2022 with Administrator permissions, but it's still the same situation.

Any idea?

like image 218
sayditto Avatar asked Nov 15 '25 10:11

sayditto


2 Answers

Drag & Drop is not yet supported in LSP-based editors. You can refer to this article:

https://developercommunity.visualstudio.com/t/cant-drag-javascript-or-css-files-onto-an-html-pag/1526177

like image 72
Xinran Shen Avatar answered Nov 18 '25 20:11

Xinran Shen


There is a work around suggested by Microsoft: Tools-->Options-->Text Editor-->HTML-->Advanced-->Use Legacy Razor Editor for Asp.NET (Yes) -->OK

like image 20
Muyideen Bello Avatar answered Nov 18 '25 20:11

Muyideen Bello



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!